Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Params for functions in jupyter lab w/ Python

I'm starting to use Jupyter lab which is nice. One thing that I have a question about is how to get the param arguments for a function that I created?

If I do my_function() and then press the tab key, I get a long list of a variety of things that are present in my environment. Such as other functions, classes, or instances (variables I defined), modules, and PARAM, which is what I care about.

It is nice that each of these are color coded, but is there an easy way to get to each of my params for my function without having to scroll through a million things?

For example in R, I can do

myfunction(<tab key>) 

to get a list of all params for that function.

like image 611
runningbirds Avatar asked May 16 '18 19:05

runningbirds


People also ask

How do you see the parameters of a function in Jupyter Notebook?

Documentation: Jupyter Notebook can show that documentation of the function you are calling. Press Shift+Tab to view the documentation.

How do you add a parameter to a function in Python?

Function blocks begin with the keyword def followed by the function name and parentheses ( ( ) ). Any input parameters or arguments should be placed within these parentheses. You can also define parameters inside these parentheses.

What kind of parameters do functions have in Python?

In Python, we can easily define a function with mandatory and optional parameters. That is, when we initialise a parameter with a default value, it becomes optional. Otherwise, the parameter will be mandatory. In the above example, man1 and man2 are mandatory because they are not initialised in the function definition.


1 Answers

press shift+tab with the cursor inside the function parenthesis to see the parameter arguments as well as the function docstring (if it has one).

like image 57
Stelios Avatar answered Oct 21 '22 13:10

Stelios