[Import-SIG] Updated PEP 395 ("Qualified Names for Modules" aka "Implicit Relative Imports Must Die!")

PJ Eby pje at telecommunity.com
Thu Nov 24 06:32:52 CET 2011


On Wed, Nov 23, 2011 at 11:37 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:

> You have yet to identify any case where a script will break for a
> reason other than reliance on implicit relative imports inside a
> package


You're right; I didn't think of this because I haven't moved past Python
2.5 for production coding as yet.  ;-)

I still think extraneous __init__.py files still exist in the field, but
I'll admit that both of these things are infrequent cases.

However, if we're going on the basis of how many newbie errors can be
solved by Just Working, PEP 402 will help more newbies than PEP 395, since
you must first *have* a package in order for 395 to be meaningful.  ;-)

(which are *supposed* to be dead in 3.x, but linger in
> __main__ solely due to the way we initialise sys.path[0]). If a script
> is going to be legitimately shipped inside a package directory, it
> *must* be importable as part of that package namespace, and any script
> in Py3k that relies on implicit relative imports fails to qualify.
>

Wait a minute...  What would happen if there were no implicit relative
imports allowed in __main__?

Or are you just saying that you get the *appearance* of implicit relative
importing, due to aliasing?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/import-sig/attachments/20111124/ff098a4d/attachment-0001.html>


More information about the Import-SIG mailing list