How to show Function Arguments in Pycharm, other IDEs? (like in Excel...)

13.5k views Asked by At

Want to show function arguments (like the "arguments" that show up in Excel when one types a formula) in any python IDE:

type:
=find()
# and this pops up:

=find(find_text, within_text, [start_num])

you will get all your arguments, in the appropriate order, right away! no need to recall 10000000 formula's syntaxes!

In Excel, we see a series of parameters for the FIND function that are very helpful; syntax, variable requirements, so forth. I want to do this in Pycharm/python too;

suggestions?

Tried googling, searching in pycharm/s options. Is this just not feasible in Python?

thanks

1

There are 1 answers

4
smac89 On

In PyCharm:

Type the name of the function with the brackets (), and then place your cursor inside the brackets and type Ctrl + P; This will show your the parameters for the function.

Here is a short gif showing this:

Pycharm parameter info

In VSCode

Vscode uses the same keyboard shortcut as IntelliJ (and by extension, Pycharm). If the shortcut does not work, you can install the key bindings extension here

Example:

Vscode parameter info

In a REPL

Open a python repl and type:

help (object)

Where object can be the name of a function or class, or any object as the name suggests.

Ex:

➜ python                                 
Python 3.7.1 (default, Dec  1 2018, 03:00:51) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> help(sum)

Help on built-in function sum in module builtins:

sum(iterable, start=0, /) Return the sum of a 'start' value (default: 0) plus an iterable of numbers

When the iterable is empty, return the start value.
This function is intended specifically for use with numeric values and may
reject non-numeric types.
>>> def f():
...     return 3
... 
>>> help(f)

Help on function f in module __main__:

f()

>>>

The help page pops up and you can read any documentation associated with the object.