Getting a list of an object's methods?

Gerrit Holl gerrit at nl.linux.org
Sun Jun 22 17:49:10 CEST 2003


Alexander Schmolck wrote:
> Try
> 
> >>> import inspect, operator
> >>> inspect.getmembers(foo, operator.isCallable)
> 
> for a start (should come pretty close, although it will also give you callables
> that aren't methods). You'll have to check this for 2.1, but if I remember
> rightly it ough to work.

Note that operator.isCallable has been deprecated since Python 2.0. You
can simply use the callable() builtin function.

yours,
Gerrit.

-- 
245. If any one hire oxen, and kill them by bad treatment or blows, he
shall compensate the owner, oxen for oxen.
        -- 1780 BC, Hammurabi, Code of Law
--
Asperger Syndroom - een persoonlijke benadering:
	http://people.nl.linux.org/~gerrit/
Het zijn tijden om je zelf met politiek te bemoeien:
	http://www.sp.nl/





More information about the Python-list mailing list