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

Thomas Wouters thomas at python.org
Wed Apr 26 20:22:01 CEST 2006


On 4/26/06, Guido van Rossum <guido at python.org> wrote:
>
> 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.
>

I don't particularly like it. You still need __init__.py's for 'import *' to
work (not that I like or use 'import *' :). The first question that pops
into my mind when I think file-less modules is "where does the
package-module come from". That question is a lot easier to answer (not to
mention explain) when all packages have an __init__.py. It also adds to
Python's consistency (which means people learn something from it that they
can apply to other things later; in that case, removing it just hampers
their growth.) And besides, it's just not that big a deal.

I don't feel strongly enough about it to object, though. However, I would
suggest adding a warning for existing, __init__.py-less directories that
would-have-been imported in 2.5. (There's an alpha3 scheduled, so it doesn't
have to go in alpha2 tonight, and it could probably be last-minuted into
beta1 too.) That should fix both Google's problems and that of everyone
having existing non-package subdirs :-) Then, if it really matters, we can
change the import in 2.6.

Note that absolute import (which will be turned on for all in 2.6)


2.7, see the PEP.

--
Thomas Wouters <thomas at python.org>

Hi! I'm a .signature virus! copy me into your .signature file to help me
spread!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20060426/9d613135/attachment.htm 


More information about the Python-Dev mailing list