Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save archerslaw/cf99c5285a3f52aa96e8 to your computer and use it in GitHub Desktop.
Save archerslaw/cf99c5285a3f52aa96e8 to your computer and use it in GitHub Desktop.
a userfull modules(inspect) for python users.
###inspect - Get useful information from live Python objects.
This module can gives you the source code from the function name. It has several different functions which is very useful when you debug. Please check the details with help().
Example:
>>> import inspect
>>> import re
>>> a = inspect.getsource(re.split)
>>> print a
def split(pattern, string, maxsplit=0):
"""Split the source string by the occurrences of the pattern,
returning a list containing the resulting substrings."""
return _compile(pattern, 0).split(string, maxsplit)
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment