[Python-Dev] Dropping __init__.py requirement for subpackages

Phillip J. Eby pje at telecommunity.com
Wed Apr 26 22:11:53 CEST 2006


At 09:56 PM 4/26/2006 +0200, Martin v. Löwis wrote:
>Phillip J. Eby wrote:
> > My counter-proposal: to be considered a package, a directory must contain
> > at least one module (which of course can be __init__).  This allows the 
> "is
> > it a package?" question to be answered with only one directory read, as is
> > the case now.  Think of it also as a nudge in favor of "flat is better 
> than
> > nested".
>
>I assume you want
>
>import x.y
>
>to fail if y is an empty directory (or non-empty, but without .py
>files). I don't see a value in implementing such a restriction.

No, I'm saying that tools which are looking for packages and asking, "Is 
this directory a package?" should decide "no" in the case where it contains 
no modules.



More information about the Python-Dev mailing list