[Python-ideas] Fixing __file__ to be absolute

anatoly techtonik techtonik at gmail.com
Thu Jan 2 14:46:53 CET 2014


On Thu, Jan 2, 2014 at 4:28 PM, Brett Cannon <brett at python.org> wrote:
> On Thu, Jan 2, 2014 at 7:37 AM, Tal Einat <taleinat at gmail.com> wrote:
>> On Wed, Jan 1, 2014 at 9:01 PM, anatoly techtonik <techtonik at gmail.com>
>> wrote:
>> > Fixing this thing will make my happy (or very sad if you'd like this).
>> >
>> > Problem is described here:
>> > http://stackoverflow.com/a/6416333/239247
>> > Summary:
>> > 1.  chdir()
>> > 2.  dirname(__file__)
>> > 3.  FAIL
>> >
>> > Proposal:
>> > from __future__ import abs__file__
>>
>> Anatoly, this subject was already discussed on this list, just three
>> months ago, in a thread you started! [1]_
>>
>> To quote one of Nick Coglahan's replies [2]_:
>>
>> > 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.
>
>
> This was also changed in Python 3.4 back in October:
> http://hg.python.org/cpython/rev/76184b5339f2

Thanks. That's just what I was looking for - a status update.
Links in emails are not telling anything about progress being
made, roadmap, problems and versions of Python. Seem like
tracker is a poor tool to track this stuff too.

Now in spite of recent Python 3 status update, the question is how
possible to make this feature more visible and implemented in
previous version as from __future__ import abs__file__?

I'd like to ask for two perspectives:
1. technical feasibility
2. political obstacles (backward compatibility policy / process obstacles),
    even if they are obvious

Also, what is the process of nominating this features to selection in
Python 2.8 (or whatever comes out of this incremental development idea)?

So, three questions with ideas in total.
--
anatoly t.


More information about the Python-ideas mailing list