A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2010-February/097417.html below:

[Python-Dev] __file__

[Python-Dev] __file__ [Python-Dev] __file__Nick Coghlan ncoghlan at gmail.com
Thu Feb 4 10:47:54 CET 2010
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 at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4