G'day,
I just noticed the above statement--
thisModule = __import__(__name__, globals())
if your subject line isn't properly visible--in pyTree.py, when hacking
around with the demo. The thisModule variable isn't used at all, and my
(perhaps very limited) understanding of the __import__ function is that this
function has no "side effects"--it will not change anything in globals()
[besides which, I think it's return value may be merely a COPY of the
globals() dictionary... either that or locals(), or both; can't remember at
the moment...]. What is the purpose of this statement, then? I tried
commenting out the statement, and the demo seemed to have gone into ga-ga
land [in that control + escape brought up the start menu (by the way, I'm
using Windows 98), a sign (I think so, anyway) that I'd better control +
alt + delete the process darn quickly or risk having to reboot...], without
bringing up the pyTree window. So the statement definitely DOES something,
and something important... but what?
This MIGHT be related to a problem I've had for well over a year, in that
global variables (there! I said it! Excuse me : of a module aren't
referenced within "callbacks" [e.g., instance methods of the form
'OnXXX(self, event)'], even when referenced in an appropriate 'global'
statement--one needs something like 'from MODULE import IDENTIFIER' instead,
which is very ugly--particularly when the module contains classes which are
to be used both when it is imported by another module, and used within a 'if
__name__ == "__main__"' construct (in which case a statement similar to
"sys.modules['MODULE'] = sys.modules['__main__']" will be necessary as a
workaround. Very, very ugly...
[Actually, not just in "callbacks" in the above paragraph, but also in
__init__ methods, for example...]
I've read and re-read the Python manuals on this matter. Can anyone throw
some light on either of these matters?
Thanks, Chris
···
-------------------------------------------------------------------------
Chris Fama <mailto:Chris.Fama@whollysnakes.com> Phone:(07) 3870 5639
Brisbane, Australia Mobile:(0400) 833 700
-------------------------------------------------------------------------
-o0= Strange but true... (?!) =0o-
The shape of plant collenchyma cells and the shape of the bubbles in
beer foam are the same - they are orthotetrachidecahedrons.