Getting a list of an object's methods?

Freddie oinkfreddie at oinkmadcowdisease.oinkorg
Sun Jun 22 14:31:01 CEST 2003


Hi,

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? The docs say 
this about dir():

Note: Because dir() is supplied primarily as a convenience for use at an 
interactive prompt, it tries to supply an interesting set of names more than 
it tries to supply a rigorously or consistently defined set of names, and its 
detailed behavior may change across releases.

Any help would be appreciated.

  Freddie

--------------------------------------------------------------
Remove the oinks from my e-mail address if you really want to




More information about the Python-list mailing list