[Python-Dev] dir() and __all__

skip at pobox.com skip at pobox.com
Sat Feb 16 03:15:54 CET 2008


    Guido> It's not consistent with what dir() of a class or instance does
    Guido> though.  -1.

Agreed.  The only official use I'm aware of is to restrict what is imported
when you execute

    from mod import *

    Raymond> >>> Queue.__all__
    Raymond> ['Empty', 'Full', 'Queue', 'PriorityQueue', 'LifoQueue']

    >> I like the second one better.

How would you easily ask an object for all its attributes?

Skip


More information about the Python-Dev mailing list