Created
April 19, 2020 14:50
-
-
Save mhtocs/03cd6be0cefd1e5db6c780364abba570 to your computer and use it in GitHub Desktop.
List all callables with exception handling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math #import whatever | |
def list_callables(module): | |
all = [] | |
for k,v in module.__dict__.items(): | |
if callable(v): | |
try: | |
all.append(v.__name__) | |
except: | |
pass | |
return all | |
math_callables = list_callables(math) #fetch all function | |
print(math_callables) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment