This is an archived version of the course. Please see the latest version of the course.

Reserved words

Like C++, Python has reserved some keywords.

You can type the following to get a list of Python keywords.

>>> import keyword 
>>> keyword.kwlist

Note that built-in data types (int, str) are NOT keywords; they are classes. So you can technically use these as variable names (but you really shouldn’t!)

None

Worth noting is the None keyword. It is basically equivalent to NULL in C++.

Like everything else, None is also an object. More specifically, it is an instance of the NoneType class (test this out!)

>>> type(None)