global name 'self' is not defined

Evan evanmason at gmail.com
Tue Dec 5 05:27:01 EST 2006


Hi Dennis, to answer your questions:

1) So far as I can see ipython generates .pyc files.
2) This morning I ran the scripts, and got the same problem using
ipython as in my earlier post.  I then deleted the .pyc file, ran the
calling script and this time it works.  I then replaced the .pyc file I
had deleted, expecting to have the problem again, but no.
3) I've tried your suggestion, and it works fine.

A few questions: Why does python use the double underscore (__main__ or
if __name__)?  I've only been using python for about 3 weeks, and I see
this syntax a lot, but haven't found an explanation for it so far?
Also, as I understand , the .pyc files should be updated every time you
change and run the equivalent .py file?

Thanks, Evan




More information about the Python-list mailing list