[Python-Dev] __file__

Nick Coghlan ncoghlan at gmail.com
Sat Feb 27 16:27:42 CET 2010


Glenn Linderman wrote:
> But if the technique can work from the command line, it seems the
> same technique could be re-used in the importer.

Not really - we only get away with the fun and games at execution time
because __main__ is a bit special (and always has been). Those tricks
would be a lot harder to pull off for a normal module import (if they
were possible at all - I'm not sure they would be).

Cheers,
Nick.


-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------


More information about the Python-Dev mailing list