sage.misc.sageinspect. If Sage is available, that code will be used here. Otherwise, use simple-minded replacements based on Python’s inspect module.
AUTHORS:
Return the definition header for any callable object.
INPUT:
This calls inspect.getargspec, formats the result, and prepends obj_name.
EXAMPLES:
sage: from sagenb.misc.sageinspect import sagenb_getdef
sage: def f(a, b=0, *args, **kwds): pass
sage: sagenb_getdef(f, 'hello')
'hello(a, b=0, *args, **kwds)'
Return the docstring associated to obj as a string. This is essentially a front end for inspect.getdoc.
INPUT: obj, a function, module, etc.: something with a docstring. If “self” is present in the docmentation, then replace it with \(obj_name\).
EXAMPLES:
sage: from sagenb.misc.sageinspect import sagenb_getdoc
sage: sagenb_getdoc(sagenb.misc.sageinspect.sagenb_getdoc)[0:55]
'Return the docstring associated to ``obj`` as a string.'