[Python-Dev] dir() and __all__

Steve Holden steve at holdenweb.com
Sat Feb 16 03:34:24 CET 2008


Maybe classes should have __all__ too, then the people who complain 
about not being able to declare private class attributes could be 
pointed at that.

regards
  Steve

Guido van Rossum wrote:
> It's not consistent with what dir() of a class or instance does though.
> 
> -1.
> 
> On Fri, Feb 15, 2008 at 5:30 PM, Raymond Hettinger <python at rcn.com> wrote:
>> Should dir(module) use __all__ when defined?
>>
>>  >>> dir(Queue)
>>  ['Empty', 'Full', 'LifoQueue', 'PriorityQueue', 'Queue', '__all__', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '_time', 'deque', 'heapq']
>>
>>  >>> Queue.__all__
>>  ['Empty', 'Full', 'Queue', 'PriorityQueue', 'LifoQueue']
>>
>>  I like the second one better.
>>
>>
>>  Raymond
>>  _______________________________________________
>>  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/guido%40python.org
>>
> 
> 
> 


-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/



More information about the Python-Dev mailing list