[Python-3000] [stdlib-sig] PEP 3108 - stdlib reorg/cleanup
Brett Cannon
brett at python.org
Thu May 1 02:34:19 CEST 2008
On Wed, Apr 30, 2008 at 5:08 PM, Guido van Rossum <guido at python.org> wrote:
> 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.
Going through the PEP the dbm suggestion seems to be the only one that
jumps out at me at possibly benefiting at moving something to the
__init__.py module. I personally don't like putting stuff in another
module and then importing as that provides two different module names
to get at the same time. I prefer there being just a single way to get
at the code.
Anyway, assuming there is no great outcry then I will take Joe's
suggestion as I like that organization more than the current one.
-Brett
More information about the Python-3000
mailing list