[Zope3-dev] packaging conventions note

Tres Seaver tseaver@zope.com
06 Dec 2002 10:14:24 -0500


On Fri, 2002-12-06 at 09:59, Guido van Rossum wrote:
> We haven't had the public discussion on this at the sprint yet.  In a
> little bit, I promise. :-)
> 
> > > We're listening on the packaging conventions. I need to discuss this
> > > public/api thing with Jim. (few minutes later) hm..he doesn't like the
> > > 'from foo import *' suggestion. :)
> > 
> > Really? Jim, why not? I think it solves some problems and the fect
> > that some independent people do this, shows that it is a good
> > thought. I like the public.py idea. +1 from my part.
> 
> -1 on anything that recommends (or even facilitates) import *.  As the
> reader of a module, import * sucks: when I see a name I don't
> recognize, I want to be able to search the module for the first
> definition.

-1 as well:  I don't even use it for the canonical example ('from
Tkinter import *'), as I can't live with the namespace pollution issues
(the Tkinter package doesn't mangle its public names).

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.

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com