Chapter 3: Variables and operators

Reserved words

face Josiah Wang

Like Java, 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 Java.

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

>>> type(None)