import overwrites __name__
apt.shansen at gmail.com
Sat May 9 00:08:03 CEST 2009
> Still I appreciate if someone could explain me why.
We can't without seeing the code. There shouldn't be any difference, so if
there is then its because your code is doing something to cause it-- break
it down to a runnable example and we may be able to tell you why, giving us
real code and real errors / output. When you distill it into a pseudocode
explanation of what you're doing and ask why it doesn't work, quite often
what you end up doing is unintentionally leaving out the cause.
E.g., I made two files;
my_name = __name__
from other import y as z
y = True
And the output is -- no matter if there's a pyc or not -- always:
There's nothing in default/standard Python which is causing this behavior--
Python doesn't run code differently based on if there's a pyc or not or if
its generating a pyc or not, not by itself. You have to be doing something
which is goofying up the interpreter somewhere. Not sure what, but it has to
be in that 'x' you're importing from :)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list