Skip to content

Instantly share code, notes, and snippets.

@chrisma
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisma/9671392e68fc0fff324c to your computer and use it in GitHub Desktop.
Save chrisma/9671392e68fc0fff324c to your computer and use it in GitHub Desktop.
Get all functions within current module
# Run it live at
# https://www.pythonanywhere.com/gists/9671392e68fc0fff324c/all_functions.py/ipython3/
import inspect, sys
def func1():
pass
def func2():
pass
all_functions = inspect.getmembers(sys.modules[__name__], inspect.isfunction)
assert all_functions == [('func1',func1), ('func2',func2)]
print('all_functions:', all_functions)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment