[Zope3-dev] packaging conventions note

Barry A. Warsaw barry@zope.com
Fri, 6 Dec 2002 11:02:24 -0500


>>>>> "GvR" == Guido van Rossum <guido@python.org> writes:

    >> I actually like exporting the public names from package scope,
    >> e.g., 'from some_package import MyClass' gives you the class
    >> itself.  My rationale is that the name of the module declaring
    >> the class is declared in is an implementation detail *to the
    >> clients of the packge.* I would find 'from some_package.public
    >> import Foo' a reasonable compromise with those who prefer to
    >> have the package's __init__ be empty.

    GvR> The new naming conventions make it possible once again to
    GvR> stick some small amount of code in __init__.py that exports
    GvR> the piblic classes.  Previously, this was problematic because
    GvR> the class name and the module name were often the same.  No
    GvR> more.  So I'm -1 on public.py now -- __init__.py will do just
    GvR> fine.  (As long as you don't use import *. :-)

IIRC, one of the criticisms you've brought up about this style is that
importing the package ends up importing all the submodules.  I think
you mentioned this as a problem with the email package's design.  I
could be misremembering, or maybe this isn't a concern for this
intended use?

-Barry