numpy 1.22.4 Pypi GitHub Homepage
Other Docs
ParametersBackRef
source(object, output=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)

The source code is only returned for objects written in Python. Many functions and classes are defined in C and will therefore not return useful information.

Parameters

object : numpy object

Input object. This can be any object (function, class, module, ...).

output : file object, optional

If output not supplied then source code is printed to screen (sys.stdout). File object must be created with either write 'w' or append 'a' modes.

Print or write to a file the source code for a NumPy object.

See Also

info
lookfor

Examples

>>> np.source(np.interp)                        #doctest: +SKIP
In file: /usr/lib/python2.6/dist-packages/numpy/lib/function_base.py
def interp(x, xp, fp, left=None, right=None):
    """.... (full docstring printed)"""
    if isinstance(x, (float, int, number)):
        return compiled_interp([x], xp, fp, left, right).item()
    else:
        return compiled_interp(x, xp, fp, left, right)

The source code is only returned for objects written in Python.

>>> np.source(np.array)                         #doctest: +SKIP
Not available for this object.
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

numpy.lib.utils.safe_eval numpy.testing._private.extbuild._convert_str_to_file numpy.info numpy.lookfor

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /numpy/lib/utils.py#629
type: <class 'function'>
Commit: