[Python-Dev] Why does PEP 8 advise against explicit relative imports?

Guido van Rossum guido at python.org
Wed Jul 17 05:48:03 CEST 2013


If sounds like the main problem with relative imports (even explicit)
is caused by ignoring the package structure and running modules inside
a package as a script, without using -m.

Maybe we should update the PEP to make this abundantly clear?

I note that an additional problem with informational PEPs like PEP 8
is that they aren't tied to a particular Python version, so even if we
solved the above issue perfectly in Python 3.4 there'd still be tons
of people applying PEP 8 to older code who would benefit from the
warning against relative imports. So maybe we should also add that to
the PEP.

-- 
--Guido van Rossum (python.org/~guido)


More information about the Python-Dev mailing list