getting dir(x), but not as list of strings?

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Wed May 21 04:17:21 EDT 2008


On Wed, 21 May 2008 07:54:32 +0000, mh wrote:

> I want to iterate over members of a module, something like:
> 
>     for i in dir(x):
>         if type(i) == types.FunctionType: ...
> 
> but of course dir() returns a list of strings.  If x is a module,
> how can I get the list of its members as their actual types?

Take a look at the `inspect` module.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list