On Thu, Jun 19, 2008 at 19:38, Pierre GM <[EMAIL PROTECTED]> wrote:
> On Thursday 19 June 2008 20:28:46 Robert Kern wrote:
>> On Thu, Jun 19, 2008 at 19:15, Pierre GM <[EMAIL PROTECTED]> wrote:
>> > Your question raises a good point: is there any consensus on using
>> > __all__ instead of the module namespace ?
>>
>> I'm not sure what you mean. Can you clarify?
>
>  __all__ is used on a regular basis in numpy instead of using modules
> namespace: why ?

The contents of numpy.core.foo, etc., are typically exposed at a
higher level, like in numpy.core.__init__ and numpy.__init__. Defining
numpy.core.foo.__all__ lets the __init__.py files just "from
numpy.core.foo import *" and have a nearly-sensible namespace.

Even if you aren't catering to the "from ... import *" use case,
including a name in __all__ is a strong and useful signal about what
is part of the public API for your module.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to