Zoom Jupyter tips

Last updated: January 4, 2023

 Table of contents

Zoom session 3, part 2

Topic: Tips while working in Jupyter, some of which specific to fastai.

Summary

Jupyter comes with a couple of convenient functionalities.
The fastai library adds a few more to that.

Here, I am using the fastai convenience function untar_data (which downloads and extract datasets from urls) as example.

If you want to run these snippets, make sure that you have already loaded that function, for instance by running:

from fastai.vision.all import *

Help (also in Python shell)

help is a Python built-in function (it is a wrapper around pydoc.help) which provides some help on code elements (functions, etc.). While other tips presented here only work on Jupyter, this also works in the Python shell:

help(untar_data)

Autocompletion

Pressing Tab after a few characters of code autocompletes or displays available options.

Function arguments

Pressing Shift+Tab inside the parentheses of a function opens a popup showing all the function arguments and their default values (if any).

Information

In Jupyter, you can access information on a Python element by prepending or appending a question mark to it:

?untar_data
untar_data?

Source code

By using two question marks, you can see the source code:

??untar_data
untar_data??

High-level description & link to online documentation (fastai only)

A convenient way to access the online documentation page of any fastai code element is to use the fastai function doc:

doc(untar_data)

Comments & questions