how to list the attributes of a class, not an object?
zuo at chopin.edu.pl
Sun Jan 24 16:56:42 CET 2010
24-01-2010, 16:28:26 Robert P. J. Day <rpjday at crashcourse.ca> wrote
> once again, probably a trivial question but i googled and didn't
> get an obvious solution. how to list the attributes of a *class*?
or more reliable:
(dir() uses __dir__ which can be implemented in any way, and default
implementation, accordinto to the docs, "attempts to produce the most
relevant, rather than complete, information").
> eg., i was playing with dicts and noticed that the type returned by
> the keys() method was "dict_keys". so i'm now curious as to the
> attributes of the dict_keys class. but i don't know how to look at
> that without first *creating* such an instance, then asking for
Why you bother about creating an instance? Just do it:
if dir() satisfies you.
Jan Kaliszewski (zuo) <zuo at chopin.edu.pl>
More information about the Python-list