I'm attempting to use the answer to Is it possible to list all functions in a module? to list functions in a range of modules. But in my interpreter I get as follows:
Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:03:43) [MSC v.1600 32 bit (In
tel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import inspect
>>> import math
>>> math.pow(5,4)
625.0
>>> inspect.getmembers(math, inspect.isfunction)
[]
>>> inspect.getmembers(inspect, inspect.isfunction)
[('_check_class', <function _check_class at 0x00C9F9C0>), ('_check_instance', <f
unction _check_instance at 0x00C9F978>), ('_get_user_defined_method', <function
_get_user_defined_method at 0x00C9FB70>), ('_getfullargs', <function _getfullarg
s at 0x00C6A4F8>), ('_is_type', <function _is_type at 0x00C9FA08>), ('_missing_a
rguments', <function _missing_arguments at 0x00C9F198>), ('_shadowed_dict', <fun
ction _shadowed_dict at 0x00C9FA50>)... foo, bar, etc]
>>> math
<module 'math' (built-in)>
>>> inspect
<module 'inspect' from 'E:\\Python33\\lib\\inspect.py'>
>>> import win32api
>>> inspect.getmembers(win32api, inspect.isfunction)
[]
>>> win32api
<module 'win32api' from 'E:\\Python33\\lib\\site-packages\\win32\\win32api.pyd'>
As per usual, I assume there's some blindingly obvious reason as to why this is failing to list all functions in half the modules I try. The best I can guess is isfunction() only works for .py modules? If there is an innate problem not related to my stupidity, is there a way to rectify this matter?
It's clearly an issue with the isfunction(), as getmembers seems to work fine:
>>> import math
>>> import inspect
>>> inspect.getmembers(math)
[('__doc__', 'This module is always available. It provides access to the\nmathe
matical functions defined by the C standard.'), ('__loader__', <class '_frozen_i
mportlib.BuiltinImporter'>), ('__name__', 'math'), ('__package__', ''), ('acos',
<built-in function acos>), ('acosh', <built-in function acosh>), ('asin', <buil
t-in function asin>)... foo, bar, etc]
I understand there's a dir() which can be used, but it's not really quite as neat.