I want to see all the variables

Steven D'Aprano steve at REMOVE.THIS.cybersource.com.au
Fri Dec 29 11:17:53 EST 2006


On Fri, 29 Dec 2006 07:57:30 -0800, wittempj 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.




More information about the Python-list mailing list