[Python-Dev] Breaking undocumented API

Fred Drake fdrake at acm.org
Thu Nov 18 14:47:05 CET 2010


On Thu, Nov 18, 2010 at 6:41 AM, Michael Foord
<fuzzyman at voidspace.org.uk> wrote:
> Along with the others +1

I agree with keeping these distinct and orthogonal as well.

> What is more important is that we have a clearly stated policy for new
> modules and adding names to existing modules so that we don't have to repeat
> this debate in five years time.

Agreed again.

> My suggestion, which fits in with the use of __all__ by the language and
> also the convention widely in use by the community already boils down to:
>
> * If __all__ exists it is definitive

I think this is overly vague.  :-)

Specifically, if something is mentioned in __all__, it's public.
Non-inclusion in __all__ doesn't imply privateness.

> * Names with leading underscores are private unless in __all__ (and if you
> want to export leading underscore names as part of a public API you should
> define __all__ or "import *" won't export them)

We shouldn't confuse non-export via "import *" with non-public, however.


  -Fred

--
Fred L. Drake, Jr.    <fdrake at acm.org>
"A storm broke loose in my mind."  --Albert Einstein


More information about the Python-Dev mailing list