+8  A: 

An example (listing the methods of the optparse.OptionParser class):

>>> from optparse import OptionParser
>>> import inspect
>>> inspect.getmembers(OptionParser, predicate=inspect.ismethod)
[([('__init__', <unbound method OptionParser.__init__>),
...
 ('add_option', <unbound method OptionParser.add_option>),
 ('add_option_group', <unbound method OptionParser.add_option_group>),
 ('add_options', <unbound method OptionParser.add_options>),
 ('check_values', <unbound method OptionParser.check_values>),
 ('destroy', <unbound method OptionParser.destroy>),
 ('disable_interspersed_args',
  <unbound method OptionParser.disable_interspersed_args>),
 ('enable_interspersed_args',
  <unbound method OptionParser.enable_interspersed_args>),
 ('error', <unbound method OptionParser.error>),
 ('exit', <unbound method OptionParser.exit>),
 ('expand_prog_name', <unbound method OptionParser.expand_prog_name>),
 ...
 ]

Notice that getmembers returns a list of 2-tuples. The first item is the name of the member, the second item is the value.

You can also pass an instance to getmembers:

>>> parser = OptionParser()
>>> inspect.getmembers(parser, predicate=inspect.ismethod)
...
codeape
perfect, the predicate part is key, otherwise you get the same thing as __dict__ with the extra meta info. Thanks.
perrierism
+1  A: 

Try the property __dict__.

Eugene Bulkin
I think you mean __dict__. But that lists the attributes of the instance, not the methods.
me_and
…that didn't work for me either. Having consulted the Markdown syntax, I think I mean \_\_dict\_\_.
me_and
No, he means dict the same way you typed it, no? With two underscores on either side. The underscores in these comments to answers don't show up, they're markup for bold evidently. But it does list things also that aren't methods, so the 'inspect' answer above works.
perrierism
A: 

There is the dir(theobject) method to list all the fields and methods of your object (as a tuple) and the inspect module (as codeape write) to list the fields and methods with their doc (in """).

Because everythingthing (even fields) might be called in python, I'm not sure there is a built-in function to list only methods. You might want to try if the object you get through dir is callable or not.

Vincent Demeester