[Python-Dev] Re: Christmas Wishlist (original) (raw)

Guido van Rossum guido at python.org
Mon Dec 15 14:34:10 EST 2003


> This would mean you couldn't have some code that still uses relative > imports, but the problem with the future statement is that it > seems so pointless: packages that only use absolute imports don't need > it, and packages that use relative imports break if it is used.

You probably want something at the package level. This may not be feasible, but it seems like you want to be able to say, "this package needs to allow relative imports for backwards compatibility".

But there is no backwards compatibility issue. Absolute imports always work, so instead of adding a "relative imports allowed" to your package, you can just change the package to use only absolute imports. Using only absolute imports is totally backwards compatible (unless your toplevel package name is the same as the name of a submodule of the package, which seems pretty sick).

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list