[Python-3000] [stdlib-sig] PEP 3108 - stdlib reorg/cleanup

Guido van Rossum guido at python.org
Thu May 1 02:08:31 CEST 2008


On Wed, Apr 30, 2008 at 5:02 PM, Brett Cannon <brett at python.org> wrote:
>  There is a general dislike in putting code in a package's __init__
>  module. Personally I am fine with doing that, but I tried not to do
>  that with the reorg. If people speak up in support of this then it can
>  happen.

I'm not sure I agree with that sentiment. Quite a few packages have
large __index__.py files. Django routinely puts lots of code there
too.

Even if people prefer not to put (too much) code in __init__.py, a
good compromise might be to put actual implementation code in a
separate submodule, and to put things like

from submodule import *  # submodule.py better define __all__...

or

from submodule import api1, api2, ...

in __init__.py.

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


More information about the Python-3000 mailing list