Reserved words
Python has reserved some keywords that you may not use for purposes other than for what they are intended.
For example, you may not name your variable if
.
Here is a complete list of Python keywords.
False
True
None
and
as
assert
async
await
break
class
continue
def
del
elif
else
except
finally
for
from
global
if
import
in
is
lambda
nonlocal
not
or
pass
raise
return
try
while
with
yield
You can type this to get a list of Python keywords. Don’t worry about what import
means for now. We will get to that later.
>>> import keyword
>>> print (keyword.kwlist)
None
Worth noting is the None
keyword. It represents the absence of a value. So it essentially means “nothing”.
This is equivalent to NULL/null in some other programming langauges.
None
is also an object. More specifically, it is an instance of the NoneType
class.
>>> type(None)