Getting a list of an object's methods?

Jeremy Yallop jeremy at jdyallop.freeserve.co.uk
Sun Jun 22 09:00:11 EDT 2003


Freddie wrote:
> I've been having some issues trying to get a list of the methods of a class. 
> In 2.2.3, this code gives me all of the object's variables and methods:
> 
> for thing in dir(self):
>     	print 'thing:', thing
> 
> In 2.1.3, on several different machines/OSes (Linux and FreeBSD), only the 
> variables show up. The same thing happens with __dict__. Is there a way to do 
> this that will work on 2.1.x, 2.2.x, and I guess 2.3.x as well? 

  self.__class__.__dict__

Jeremy.




More information about the Python-list mailing list