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

Paul Rubin http
Tue Mar 9 17:44:40 EST 2004


Josiah Carlson <jcarlson at nospam.uci.edu> writes:
> from MODULE import NAMES as RENAME searching HOW
> import NAMES as RENAME from MODULE searching HOW

I like this.

> Or for backwards compatibility:
> from HOW.MODULE import NAMES as RENAME
> import HOW.MODULE.NAMES as RENAME

I don't see any need for this.  Backwards compatibility doesn't
require adding new stuff.  Just leave those forms the way they were.

> Where HOW is of the form:
> -<INTEGER>[.PACKAGE1[.PACKAGE2[...]]]

> for HOW:
> -1.sibling_package
> maps to ../sibling_package/MODULE.(py|pyc|pyo|pyd|so|dll)

> -2.uncle_package.cousin_package
> maps to ../../uncle_package/cousin_package/MODULE.(ext)


Ugh!  What's wrong with ../sibling_package or
../../uncle_package/cousin_package instead of the -1,-2 stuff?

> child_package.grandchild_package.great_grandchild_module
> maps to ./child_package/grandchild_package/great_grandchild_module.(ext)
> 
> I think such behavior is clear enough magical syntax, what do others think?

I think it's ok to use slashes.



More information about the Python-list mailing list