In Python, dir() returns a list of names in the current local scope. __doc__ returns the full docstring of the object.
How can I list all the names in the current local area and print the first line of each docstring line?
To clarify: for import numpy as np I would like to get a list of short descriptions of all the names returned by dir(np) , for example. print(np.nonzero.__doc__.split('.', 1)[0]) .
How can i do this?
python methods oop metaprogramming docstring
Josh reuben
source share