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

Josiah Carlson jcarlson at nospam.uci.edu
Fri Mar 12 02:06:38 EST 2004


> If people do not care for
> 
> import -2.MODULE
> from -1.MODULE import NAMES as RENAME
> 
> Would it be possible and/or preferrable to have something like this work:
> 
> import relative(2).MODULE
> from relative(1).MODULE import NAMES as RENAME

I don't know the Python semantics for mixing statements and expressions 
like that.  Really, relative(<INTEGER>) would end up with the same 
magical internals, except that "relative" would probably need to be a 
builtin (which is generally frowned upon).

Personally, I don't favor using functional notation in order to handle 
module loading.  If we wanted a function-based import, we'd all be using 
__import__().

  - Josiah



More information about the Python-list mailing list