2.1.1 global weirds
robin at jessikat.fsnet.co.uk
Mon Aug 13 00:29:09 CEST 2001
In message <20010812195951.22E90392B at darjeeling>, Moshe Zadka
<m at moshez.org> writes
>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.
In that case you could really say it's not a module and invent a name. I
wouldn't be able to import it.
More information about the Python-list