2.1.1 global weirds

Moshe Zadka m at moshez.org
Sun Aug 12 21:59:51 CEST 2001


On Sat, 11 Aug 2001, Robin Becker <robin at jessikat.fsnet.co.uk> wrote:

> The real wart I feel is that the module a has two names, one when run as
> a script and the other when imported. 
> 
> I suppose there is some overriding implementation issue, but it seems to
> me that in the file a.py
> 
> __file__ and __name__ ought always to be defined and given the
> appropriate 'right' values.

What would you want to do if the script is not named "a.py" but "a"?
__name__ is supposed to be a valid entry into sys.modules.
-- 
The Official Moshe Zadka FAQ: http://moshez.geek
The Official Moshe Zadka FAQ For Dummies: http://moshez.org
Read the FAQ




More information about the Python-list mailing list