'Quick Docstrings in Colaboratory
I'm starting to play with Colaboratory but I've noticed that shift-tab
doesn't pop up Docstrings for functions as it does in Jupyter.
Is this functionality absent or just accessed some other way?
Solution 1:[1]
Shift-tab dedents. To see contextual help inline, hit tab after an open parens, e.g.,
import os
os.open(
Or, execute the cell with a trailing ?
and help will open in the bottom pane, e.g,.
import os
os.open?
Solution 2:[2]
This is what helped me e.g. Image( and then CTRL+Shift+Space bar do it with only one bracket.
Solution 3:[3]
Ctrl +
Space helped me. Both for docstring and autocomplete.
Solution 4:[4]
As of 2020-03-20 on Chrome, if you just mouse over the function, a small pop-up shows the input parameters.
As you start typing them auto completion is offered.
And if you press Ctrl while hovering, the function becomes a link that when clicked opens up the documentation of the function.
Autocomplete works with Ctrl+Space or simply Tab depending on situation.
Note: It must know the type of the object it is working with. So if you do data.transform() and data has no value yet, Colab won't know what to display because .transform() depends on what you apply it to. You can select the line(s) where data is created and run only those with Ctrl+Shift+Enter (run selected lines only).
Solution 5:[5]
If you're in a parenthesis or between arguments (eg after a comma), tab will show you the docstring -- so if you are typing something like print('hello', sep='')
, then tab after the paren or between the comma and the next arg will show you the docstring.
Hope that it helped.
Solution 6:[6]
space
works for me. If you've closed a pop-up docstring (e.g with the esc
key), then you can reopen it by pressing space
.
This will also input a space, so you can remove it with backspace
but the docstring will remain in view. As usual, which docstring you get will depend on where your caret is.
Solution 7:[7]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Bob Smith |
Solution 2 | |
Solution 3 | RobC |
Solution 4 | |
Solution 5 | Tshilidzi Mudau |
Solution 6 | |
Solution 7 | Gediz GÃœRSU |