Classes are not members of their respective modules??

Emile van Sebille emile at fenx.com
Tue Aug 20 03:43:10 CEST 2002


Robert Dickinson
> I am trying to get info about the classes in my running system. Having
> gotten the modules, I wanted to get the classes defined in them.
However,
>     classes = inspect.getmembers(module,inspect.isclass)

Hmmm.... this works for me:

C:\>python
ActivePython 2.1, build 210 ActiveState)
based on Python 2.1 (#15, Apr 19 2001, 10:28:27) [MSC 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib
>>> import inspect
>>> classes = inspect.getmembers(urllib,inspect.isclass)
>>> for ii in classes: ii
...
('FancyURLopener', <class urllib.FancyURLopener at 0080C0D4>)
('URLopener', <class urllib.URLopener at 00815894>)
('addbase', <class urllib.addbase at 00816DF4>)
('addclosehook', <class urllib.addclosehook at 00816E64>)
('addinfo', <class urllib.addinfo at 00818874>)
('addinfourl', <class urllib.addinfourl at 008188E4>)
('ftpwrapper', <class urllib.ftpwrapper at 007E500C>)
>>>

--

Emile van Sebille
emile at fenx.com

---------







More information about the Python-list mailing list