Module __file__ attribute in Python 3

MRAB google at mrabarnett.plus.com
Fri Aug 29 20:31:29 EDT 2008


On Aug 29, 6:11 pm, "Diez B. Roggisch" <de... at nospam.web.de> wrote:
> > That will mean that there will be no (easy?) way to determine after the
> > import whether the module was imported from a source file or a compiled
> > file. I've suggested that the original justification for the patch no
> > longer applies, and that the secondary purpose of the patch is better
> > solved by leaving __file__ as it is in Python 2.x, and introducing a new
> > attribute __source__.
>
> > What do people think? There seems to be a little interest on the python-
> > dev list from a couple of people, but not enough to actually lead to any
> > action. Does anyone care what m.__file__ is? Does anyone else feel that
> > this issue is worth pursuing?
>
> I'm +1 on this. Introducing __source__ shouldn't break anything, and is a
> minor change as the mapping of loaded file to defining file is already
> done.
>
+1. Leave __file__ as it is. Changing it seems an unnecessary break
with previous versions.



More information about the Python-list mailing list