function name + tab does not return docstring in I

2020-05-20 08:21发布

In IPython, I am used to write

function(

and then strike a tab, and get the contents of the docstring and a list of the named arguments. However, this stopped working since I installed IPython 2.0. Is there an explanation or a know fix?

3条回答
何必那么认真
2楼-- · 2020-05-20 08:26

Shift-tab only works when you place the edit cursor inside or after the object. Not when it's at the start of the object. This gotcha is not documented anywhere...!

I filed jupyter issue Shift-Tab completion doesn't work when edit cursor is at the start of the object #1902

查看更多
三岁会撩人
3楼-- · 2020-05-20 08:28

To display docstrings in Python one can use ? character as a shorthand.

You can place the ? character before or after (no space allowed) the object you are looking for docs.

To access the source code simply use ?? instead.

Source: Help and Documentation in IPython

查看更多
Summer. ? 凉城
4楼-- · 2020-05-20 08:47

Oh, the shortcut is now shift+tab.

查看更多
登录 后发表回答