[Python-ideas] PEP: Distributing a Subset of the Standard Library

Chris Angelico rosuav at gmail.com
Mon Nov 28 21:48:03 EST 2016


On Tue, Nov 29, 2016 at 12:14 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> What if I have two files?
>
> # a.py
> try:
>     import spam
> except ImportError:
>     import ham as spam
>
> # b.py
> try:
>     import spam
> except ImportError:
>     import cornedbeef as spam
>

In the same project? Then you already have a maintenance nightmare,
because 'spam' will sometimes mean the same module (with state shared
between the files), but might mean two distinct modules (and thus
unrelated module objects). In different projects? They won't conflict.

ChrisA


More information about the Python-ideas mailing list