How to show function parameters in IPython?

2019-04-24 02:26发布

问题:

I read that pressing shift+tab after a function displays the function's docstring in an IPython notebook, but this does not seem to work in my IPython (no notebook). I run IPython 4.0.0 on Ubuntu.

Any suggestion?

回答1:

The standard (console) IPython does not support the call tips via <shift> + <tab>. But a question mark before or after the function shows you the docstring:

In [1]: list.index?
Docstring:
L.index(value, [start, [stop]]) -> integer -- return first index of value.
Raises ValueError if the value is not present.
Type:      method_descriptor  

As an alternative you can use the qtconsole version:

ipython qtconsole

Then:

In [1]: list.index(

Should show you a box with a call tip without pressing <shift> + <tab>:



回答2:

Press Tab+Shift, it works for jupyter notebook 5.6.0 version.



标签: ipython