Introspection, importing and Flash

Follower follower at gmail.com
Thu Jul 1 14:55:05 CEST 2004


> What you seek is the dir() function, in concert with the getattr()  
> function. 
Note the standard `dir()` proviso:

"Because dir() is supplied primarily as a convenience for use at an
interactive prompt, it tries to supply an interesting set of names
more than it tries to supply a rigorously or consistently defined set
of names, and its detailed behavior may change across releases."

 -- <http://www.python.org/doc/current/lib/built-in-funcs.html>

Off the top of my head I'd say you'd use `__slots__` if it exists,
otherwise use `__dict__`. But I'm thinking this is possibly a FAQ that
has a "proper" answer someone else will point to.

--Phil.



More information about the Python-list mailing list