PEP 328, absolute/relative import

Peter Hansen peter at engcorp.com
Thu Aug 11 20:55:57 CEST 2005


Bengt Richter wrote:
> Will/should an __init__.py in the current directory be required,
> to control what happens (and lessen the probability of accidental
> collision from a random working directory)?

I don't think so.  That would simply shift the possibility of mysterious 
behaviour from the issue of colliding file names to the issue of whether 
an __init__.py exists somewhere.  Shouldn't one be allowed to treat 
files in the current directory as regular Python scripts even if the 
that directory contains an __init__.py so that it can be found as a 
Python package *in other contexts*?

-Peter



More information about the Python-list mailing list