Guido van Rossum wrote: > On Wed, Feb 3, 2010 at 12:47 PM, Nick Coghlan <ncogh...@gmail.com> wrote: >> On the issue of __file__, I'd suggesting not being too hasty in >> deprecating that in favour of __source__. While I can see a lot of value >> in having it point to the source file more often with a different >> attribute that points to the cached file, I don't see a lot of gain to >> compensate for the pain of changing the name of __file__ itself. > > Can you clarify? In Python 3, __file__ always points to the source. > Clearly that is the way of the future. For 99.99% of uses of __file__, > if it suddenly never pointed to a .pyc file any more (even if one > existed) that would be just fine. So what's this talk of switching to > __source__?
I originally proposed it, not knowing that Python 3 already changed the meaning of __file__ for byte code files. What I really wanted to suggest is that it should be possible to tell what gets really executed, plus what source file had been considered. So if __file__ is always the source file, a second attribute should tell whether a byte code file got read (so that you can delete that in case you doubt it's current, for example). Regards, Martin _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com