Skip to content

Instantly share code, notes, and snippets.

@mhtocs
Created April 19, 2020 14:50
Show Gist options
  • Save mhtocs/03cd6be0cefd1e5db6c780364abba570 to your computer and use it in GitHub Desktop.
Save mhtocs/03cd6be0cefd1e5db6c780364abba570 to your computer and use it in GitHub Desktop.
List all callables with exception handling
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