[Pyobjc-dev] Re: [Python-Dev] The meaning of __all__
Brought to you by:
ronaldoussoren
From: Guido v. R. <gu...@py...> - 2003-01-03 16:38:13
|
> There's a discussion over on the pyobjc developers mailing list at the > moment about the use of __all__. > > Some people suggested that for a certain module we only put "often > used" items in __all__, so that "from module import *" will import only > these commonly used items into your namespace. The module would contain > other items which *are* useful and which should be callable from the > outside, but these would have to be explicitly imported into your > namespace (or used via "import objc; objc.SetVerbose()". > > This doesn't feel right to me, as I've always used __all__ to mean "the > whole externally visible API", and I've considered anything else that > the module exports basically an artefact of the implementation. But > when I looked this up in the reference manual it is rather vague about > this. > > Any opinions on the matter? __all__ should contain the entire public API. It's mostly intended to avoid accidentally exporting other things you've *imported* like os, sys, and other library modules. Another way of doing that would be to write e.g. import sys as _sys but I don't like excessive underscoring. --Guido van Rossum (home page: http://www.python.org/~guido/) |