Google Colab - Code Editing Help


Advertisements

The present day developers rely heavily on context-sensitive help to the language and library syntaxes. That is why the IDEs are widely used. The Colab notebook editor provides this facility.

In this chapter, let us see how to ask for context-sensitive help while writing Python code in Colab. Follow the steps that have been given wherever needed.

Function List

Step 1 − Open a new notebook and type in the following code in the Code cell −

import torch

Step 2 − Run the code by clicking on the Run icon in the left panel of the Code cell. Add another Code cell and type in the following code −

Tensor = torch.

At this point, suppose you have forgotten what are the various functions available in torch module. You can ask for the context-sensitive help on function names by hitting the TAB key. Note the presence of the DOT after the torch keyword. Without this DOT, you will not see the context help. Your screen would look like as shown in the screenshot here −

Function List

Now, select the desired function from the list and proceed with your coding.

Function Documentation

Colab gives you the documentation on any function or class as a context-sensitive help.

Type the following code in your code window −

Tensor = torch.cos(

Now, hit TAB and you will see the documentation on cos in the popup window as shown in the screenshot here. Note that you need to type in open parenthesis before hitting TAB.

Function Documentation

In the next chapter, we will see Magics in Colab that lets us to do more powerful things than what we did with system aliases.

Advertisements