__file__ for relative imports

Robin Becker robin at jessikat.fsnet.co.uk
Thu Mar 21 19:37:26 EST 2002


In article <mailman.1016754857.17727.python-list at python.org>, Ken Seehof
<kseehof at neuralintegrator.com> writes
>> Robin Becker <robin at jessikat.fsnet.co.uk> writes:
>> 
>> > Is there an obvious reason why modules imported from the current
>> > directory don't have an absolute pathname for __file__?
....
>I keep bumping into that one too.  I can't think of any advantage
>for the current semantics, so I am submitting a PEP.  I didn't see
>a bug in sf or an existing PEP, but I might have missed something
>so please let me know.  Seems like a PEP is more appropriate than
>a bug report though.
>
>I can't think of any reason for it to be difficult to implement.
>Seems like the code that assigns to __file__ in the first place
>could simply call abspath(), which should give correct results at
>load time.  Seems like this PEP would probably only require one
>line of code.
>
>- Ken Seehof <kseehof at neuralintegrator.com>
>
good thinking :)

I suppose if Bill Goats gets his way then current directory will cease
to have a meaning and we'll all be whining about database rows etc
mumble whine :(
-- 
Robin Becker



More information about the Python-list mailing list