Get a function definition/implementation hint similar to the one shown in pycharm.

Cameron Simpson cs at
Mon Oct 18 17:22:00 EDT 2021

On 18Oct2021 01:43, Hongyi Zhao <hongyi.zhao at> wrote:
>I've written the following python code snippet in pycharm:
>import numpy as np
>from numpy import pi, sin
>a = np.array([1], dtype=bool)
>if|vert(a) == ~a:
>    print('ok')
>When putting the point/cursor in the above code snippet at the position denoted by `|`, I would like to see information similar to that provided by `pycharm`, as shown in the following screenshots:
>But I wonder if there are any other python packages/tools that can help 
>me achieve this goal?

Broadly, you want the "inspect" module, which is part of the stdlib, 
documented here:

It has many functions for extracting information about things, and you 
want the signature() function to get the parameters and type annotations 
of a function.

    def f(a):

    sig = signature(f)

You also want the function docstring for the help text, which is 
"f.__doc__" in the example above. This is what gets printed by help():

    >>> import numpy as np
    >>> help(np.invert)

It may be that PyCharm has additional information about some libraries 
allowing it to include a reference to the only documentation.

Cameron Simpson <cs at>

More information about the Python-list mailing list