[Python-ideas] 'from os.path import FILE, DIR' or internal structure of filenames

INADA Naoki songofacandy at gmail.com
Sun Sep 29 05:28:45 CEST 2013

os.path.abspath(__file__) returns wrong path after chdir.
So I don't think abspath of module can be trivially and reliably derived
from existing values.

$ cat foo.py
import os

$ python foo.py

On Sun, Sep 29, 2013 at 9:21 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:

> Note that any remaining occurrences of non-absolute values in __file__ are
> generally considered bugs in the import system. However, we tend not to fix
> them in maintenance releases, since converting relative paths to absolute
> paths runs a risk of breaking user code.
> We're definitely *not* going to further pollute the module namespace with
> values that can be trivially and reliably derived from existing values.
> Cheers,
> Nick.
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas

INADA Naoki  <songofacandy at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130929/7a4ee94a/attachment.html>

More information about the Python-ideas mailing list