[Python-Dev] Conflicts [was Re: Keyword meanings [was: Accept just PEP-0426]]

Chris Angelico rosuav at gmail.com
Sun Dec 9 03:51:09 CET 2012


On Sun, Dec 9, 2012 at 1:11 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> On 09/12/12 12:32, Chris Angelico wrote:
>>
>> On Sun, Dec 9, 2012 at 12:15 PM, Steven D'Aprano<steve at pearwood.info>
>> wrote:
>>>
>>> Assuming that two software packages Spam and Ham install into directories
>>> Spam and Ham, how can merely having them installed side-by-side lead to a
>>> conflict?
>>>
>>> I can see how running or importing Spam and Ham together might lead to
>>> problems. And I can see that if package Spam wants to install into
>>> directory Ham, that would be bad. But who does that?
>>
>>
>> If two packages Spam and Ham both define a module Jam, then the one
>> that gets loaded will depend on the search path. That would be one
>> form of conflict.
>
>
> import Spam.Jam
>
> import Ham.Jam
>
> What am I missing?
>
>
> Why would a software package called "Spam" install a top-level module called
> "Jam" rather than "Spam"? Isn't the whole point of Python packages to solve
> this namespace problem?

That would require/demand that the software package MUST define a
module with its own name, and MUST NOT define any other top-level
modules, and also that package names MUST be unique. (RFC 2119
keywords.) That would work, as long as those restrictions are
acceptable.

ChrisA


More information about the Python-Dev mailing list