[Python-Dev] Add __exports__ to modules

M.-A. Lemburg mal@lemburg.com
Thu, 11 Jan 2001 18:25:20 +0100


Thomas Wouters wrote:
> 
> On Thu, Jan 11, 2001 at 04:33:28PM +0100, M.-A. Lemburg wrote:
> 
> > > Please don't use __all__.  At the moment, __all__ is the only way
> > > to easily tell whether a particular module object really represents
> > > a package, and the only way to get the list of submodule names.
> >
> > But __all__ has to be user-defined, so I don't buy that argument.
> > Note that the only true way to recognize a package is by looking
> > for an attribute "__path__" since Python adds this for packages
> > only.
> 
> Ehm.... What, exactly, prevents usercode from doing
> 
> __path__ = "neener, neener"
> 
> ? In other words, even *that* isn't a true way to recognize a package. You
> can see what isn't a package, but not what is.

Purists.... ;-)

-- 
Marc-Andre Lemburg
______________________________________________________________________
Company:                                        http://www.egenix.com/
Consulting:                                    http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/