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

Guido van Rossum guido at python.org
Wed Apr 26 19:46:21 CEST 2006


On 4/26/06, Benji York <benji at benjiyork.com> wrote:
> Guido van Rossum wrote:
> > So I have a very simple proposal: keep the __init__.py requirement for
> > top-level pacakages, but drop it for subpackages.
>
> So this would mean that current non-package subdirectories in a package
> (that contain things like data files or configuration info) would become
> packages with no modules in them?

Yup. Of course unless you try to import from them that wouldn't
particularly hurt, except if the subdir name happens to be the same as
a module name.

Note that absolute import (which will be turned on for all in 2.6)
will solve the ambiguity; the only ambiguity left would be if you had
a module foo.py and also a non-package subdirectory foo. But that's
just asking for trouble.

--
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list