Neil Cerutti <[EMAIL PROTECTED]> wrote:

> dir( [object]) 
>   
>   [...] The list is not necessarily
>   complete. If the object is a module object, the list contains
>   the names of the module's attributes. If the object is a type
>   or class object, the list contains the names of its attributes,
>   and recursively of the attributes of its bases. Otherwise, the
>   list contains the object's attributes' names, the names of its
>   class's attributes, and recursively of the attributes of its
>   class's base classes. The resulting list is sorted
>   alphabetically. [...]
> 
> It's unclear to me what attributes an object could have that
> aren't included in the above list.

For a start the potentially infinite list of attributes handled by 
__getattr__ or __getattribute__:

>>> class C(object):
        def __getattribute__(self, name):
                if name.startswith('weird'):
                        return 42

                
>>> c = C()
>>> c.weirdattribute
42
>>> dir(c)
[]

Any objects which are actually implemented as C extensions are quite likely 
to have attributes that dir() cannot see.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to