[Import-SIG] What if namespace imports weren't special?

Eric V. Smith eric at trueblade.com
Tue Jul 12 09:57:59 CEST 2011


On 7/12/2011 3:53 AM, Nick Coghlan wrote:

> *ding* <--- lightbulb
> 
> However, the __pycache__ example did just trigger an idea that may
> give us the best of both worlds.
> 
> 1. We use a shared marker *directory* called __package__ to indicate
> partitioned packages. The import system just does a stat check for
> __init__.py and a __package__ subdir to see if a directory is a Python
> package directory.
> 
> 2. All the .pyp files go inside the __package__ subdir rather than
> being placed directly in the same directory as the package source
> code.

Why would we need the .pyp files, if we already have the __package__
subdir? Isn't the existence of the subdir enough?

The only reason I can think of is for mercurial, which doesn't like
empty directories. But then the file could be anything, and python would
never look for it. For tools like RPM the files in the subdir would need
to be unique per-RPM, but I don't think that's Python's concern.

Eric.



More information about the Import-SIG mailing list