I want to see all the variables

wittempj@hotmail.com martin.witte at gmail.com
Fri Dec 29 11:53:53 EST 2006



On Dec 29, 5:17 pm, Steven D'Aprano
<s... at REMOVE.THIS.cybersource.com.au> wrote:
> On Fri, 29 Dec 2006 07:57:30 -0800, witte... at hotmail.com wrote:
> > What do you mean? Can you specify which special functions you don't
> > see?
> > I get:
> > py> class X:
> >    pass
> > py> dir(X)
> > ['__doc__', '__module__']How about these?
>
> >>> X.__dict__{'__module__': '__main__', '__doc__': None}>>> X.__name__
> 'X'
> >>> X.__bases__()
>
> Now that's interesting... if __name__ and __bases__ don't live in the
> class __dict__, where do they live? What other methods and attributes are
> invisibly in X?
>
> --
> Steven.

Well, then we have to lookup what dir() does --
http://docs.python.org/lib/built-in-funcs.html -- it tries to bring up
the interesting attributes of an object, apparently __name__ and
__bases__ are considered to be not so interesting....




More information about the Python-list mailing list