[Python-3000] PEP to change how the main module is delineated
Josiah Carlson
jcarlson at uci.edu
Mon Apr 23 22:20:46 CEST 2007
"Brett Cannon" <brett at python.org> wrote:
[snip]
> So the questions for people to weigh in on are:
[snip]
> * For ../bacon.py
[snip]
> + Should we walk up the directories until __init__.py is not
> found and check for that directory on sys.path?
> Costly startup, but allows for relative imports to work.
+.99, but should be applied regardless of ../bacon.py, bacon.py, or
spam/bacon.py .
Generally, I believe that we should advance up the file system/whatever
paths until we run out of __init__.py . That would give every package,
module, etc., a unique name that is the same regardless of whether it is
run as bacon.py, ../bacon.py, or spam/bacon.py . I also realize that
this idea may not be popular.
> If people want a simple inference rule we can ditch __main__ entirely
> and just go with a simple rule that would be more costly for startup.
Ditch __main__, at least check for path/__init__.py when path/bacon.py
is run. Whether to advance up the parent paths, and/or how deep to
advance up the parent paths I don't know. I know what I want, but I
understand that it may not be what others want (especially when
confronted with NFS, database imports, etc.).
- Josiah
More information about the Python-3000
mailing list