PEP 328: Imports: Multi-Line and Absolute/Relative

AdSR artur_spruce at yahoo.com
Wed Mar 24 03:19:19 EST 2004


Josiah Carlson <jcarlson at nospam.uci.edu> wrote:
> > I'll miss the current behavior of import, though. Somehow it feels
> > more intuitive to me. Oh, well, practicality beats purity - or
> > personal taste...
> 
> You can still use classic import semantics, -<INTEGER> is optional.

By "current" I meant search in current package first. Anyway, I
thought it over and concluded that the behavior proposed in the PEP,
whether it makes more sense than what is now or not, is at least
closer to what is practiced on POSIX systems for search path: Current
directory is not in the search path, you have to say explicitly that
you're running the program from current dir (like "./script").

So, "pkg.inpkg.mod" is always absolute, ".mod" is similar to
"./script", and "-2.outpkg.mod" reads better than ".....outpkg.mod"
(analogous to "../../outdir/script").

Of other proposals, ".__parent__" is logical but introduces yet
another (long) name, and ".__pkg__" just doesn't say clearly that you
go upwards, so you might prefer ".__up__" instead. I still like
"-<INTEGER>." better though.

Just some morning wake-up thinking,

AdSR



More information about the Python-list mailing list