PyDocs

Nav

Python Runtime Services

getsourcelines

inspect

function (source)
  • getsourcelines(object)
Return a list of source lines and starting line number for an object.

The argument may be a module, class, method, function, traceback, frame,
or code object.  The source code is returned as a list of the lines
corresponding to the object and the line number indicates where in the
original source file the first line of code was found.  An OSError is
raised if the source code cannot be retrieved.
Changed in 3.3
  • 3.3: OSError is raised instead of IOError, now an alias of the former.
0 Examples
No examples for inspect/getsourcelines.
See Also
No see-alsos for inspect/getsourcelines
0 Notes
No notes for getsourcelines