A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2013-July/127383.html below:

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

[Python-Dev] Why does PEP 8 advise against explicit relative imports?Barry Warsaw barry at python.org
Tue Jul 16 16:48:55 CEST 2013
On Jul 16, 2013, at 02:02 PM, Thomas Wouters wrote:

>In my experience changing the name of a package is problematic for more
>reasons than just 'import'. We used to do the put-in-a-package thing for
>third-party packages at Google, and we quit doing it because it was just
>too painful: it's hard to find all the places that reference the package by
>name (think of __import__, or mucking in sys.modules), and it's extra
>problematic with packages that contain extension modules. You can't rename
>a package, even for 'vendoring a package', without carefully checking
>whether it'll work -- unless you don't care if it'll work, of course :) The
>alternative is to include a package *without* changing its name (by adding
>the right directory, without __init__.py, to sys.path) and that has worked
>out a lot better for us.

Vendoring also gives no end of headaches to distro packagers because we have
to un-vendor that stuff, which can lead to a mess of patches on top of
upstream.

>Even so, there's no reason for *the standard library* to use explicit
>relative imports, and that's what PEP 8 is supposed to cover, right? :)

Right!  It doesn't bother me at all that this particular recommendation may be
followed by third parties too. :)

-Barry
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4