How to show function parameters in IPython?

元气小坏坏 提交于 2019-12-22 03:21:52

问题


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.



来源:https://stackoverflow.com/questions/34393217/how-to-show-function-parameters-in-ipython

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!