[Python-Dev] Breaking undocumented API
Michael Foord
fuzzyman at voidspace.org.uk
Thu Nov 18 11:54:23 CET 2010
On 17/11/2010 21:22, Georg Brandl wrote:
> Am 17.11.2010 22:16, schrieb Éric Araujo:
>>> Excluding a builtin name from __all__ sounds like a perfectly sensible
>>> idea, so even if it wasn't deliberate, I'd say it qualifies as
>>> fortuitous :)
>> But then, a tool that looks into __all__ to find for example what
>> objects to document will miss open. I’d put open in __all__.
> So it comes down again to what we'd like __all__ to mean foremost:
> public API, or just a list for "import *"?
Well, as noted earlier in this discussion - the language reference
*states* that __all__ defines the module level public API.
From:
http://docs.python.org/reference/simple_stmts.html#grammar-token-import_stmt
"If the list of identifiers is replaced by a star ('*'), all public
names defined in the module are bound in the local namespace of the
import statement."
...
"The public names defined by a module are determined by checking
the module’s namespace for a variable named __all__"
If we decide that __all__ is purely for "import *" we should refine the
use of the word public on this page.
All the best,
Michael Foord
> Georg
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/fuzzyman%40voidspace.org.uk
--
http://www.voidspace.org.uk/
READ CAREFULLY. By accepting and reading this email you agree,
on behalf of your employer, to release me from all obligations
and waivers arising from any and all NON-NEGOTIATED agreements,
licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap,
confidentiality, non-disclosure, non-compete and acceptable use
policies (”BOGUS AGREEMENTS”) that I have entered into with your
employer, its partners, licensors, agents and assigns, in
perpetuity, without prejudice to my ongoing rights and privileges.
You further represent that you have the authority to release me
from any BOGUS AGREEMENTS on behalf of your employer.
More information about the Python-Dev
mailing list