Skip to content

Instantly share code, notes, and snippets.

@rahul8590
Created May 29, 2013 15:37
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 rahul8590/5671253 to your computer and use it in GitHub Desktop.
Save rahul8590/5671253 to your computer and use it in GitHub Desktop.
""" This Small snippet will list the set of functions present in the module
__doc__
__file__
__name__
__package__
information about the module.
Hello module used in here is a simple py file for Bottle framework.
"""
import inspect
# Here we are assuming the module hello has a set of functions
import hello as h
for name,data in inspect.getmembers(h):
if name == '__builtins__':
continue
print name , repr(data)
"""The output of the above code
will be somehting like this
---------------------------------------
__doc__ None
__file__ 'hello.pyc'
__name__ 'hello'
__package__ None
index <function index at 0x10bc9bde8>
route <function route at 0x10bfa5de8>
run <function run at 0x10bfa6e60>
template <function template at 0x10bfa92a8>
------------------------------------------
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment