how to list the attributes of a class, not an object?

Robert P. J. Day rpjday at crashcourse.ca
Sun Jan 24 11:02:48 EST 2010


On Sun, 24 Jan 2010, Alf P. Steinbach wrote:

> * Robert P. J. Day:
> >   once again, probably a trivial question but i googled and didn't
> > get an obvious solution.  how to list the attributes of a *class*?
> >
> >   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
> > "dir(dk)".
>
> Like,
>
>   dir( list )
>
> where 'list' is the built-in type.
>
> There's a pretty-printer for that somewhere, but I can't recall.

  except that doesn't work for

  >>> dir(dict_keys)

so what's the difference there?

rday
--

========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

            Linux Consulting, Training and Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Twitter:                                       http://twitter.com/rpjday
========================================================================



More information about the Python-list mailing list