[Python-Dev] Relative vs. absolute imports

Nick Coghlan ncoghlan at iinet.net.au
Thu May 20 19:02:46 EDT 2004


M.-A. Lemburg wrote:
>   I don't object absolute imports at all, but I like the
>   possibilitiy to package'ify existing Python module/module
>   sets by simply copying them into a newly created package
>   directory.

Doesn't PEP 328 actually make it *easier* to 'packagise' an existing module?

If it wasn't in a package before, all of its imports *must* be absolute. 
With PEP 328, you can copy it into a package, and it will continue to 
work as before. With the current scheme, I understand that the newly 
packagised module may break if any if its new sibling modules shadow 
something in the standard library, site-packages or sys.path.

Cheers,
Nick.
Neologisms ahoy!

-- 
Nick Coghlan               |     Brisbane, Australia
Email: ncoghlan at email.com  | Mobile: +61 409 573 268




More information about the Python-Dev mailing list