Re: [Python-Dev] __file__
Brett Cannon wrote:
But what does "expected location" mean? If I am importing foo.bar where foo.__path__ has multiple path entries, which one is supposed to be used to set the hypothetical location of source for __file__? I guess going with the first one would be somewhat reasonable, but it's definitely a guess.
No, it wouldn't be a guess, it would be based on where the compiled bytecode was actually found (wherever in foo.__path__ that may have been). So __file__ would be the same regardless of whether or not the source code was actually physically present or not. __compiled__ would be set only if the code being executed was read from that file rather than from __file__. Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia ---------------------------------------------------------------
participants (1)
-
Nick Coghlan