Copyright (c) Hyperion Entertainment and contributors.

AmigaOS Manual: Reserved Python Words

From AmigaOS Documentation Wiki
Revision as of 11:39, 21 August 2022 by Janne Peräaho (talk | contribs) (Added keyword descriptions)
Jump to navigation Jump to search

Python has 34 keywords that have a predefined meaning and thus they cannot be used as a variable name. The keywords are:

Keyword Description
and A logical operator
as
assert
break
class
continue
def Defines a function
del Deletes an object
elif
else
except
exec
False
finally
for Creates a for loop
from Imports a part of a module
global Declares a global variable
if
import Imports a module
in Checks if a value is present in an array
is Tests if two values are equal
lambda Defines an anonymous function
None
not A logical operator
or A logical operator
pass Does nothing, a null statement
print
raise Raises an exception
return Exits a function and returns a value
True
try
while Creates a while loop
with
yield

All the keywords except False, None, and True are in lowercase and they must be written as they are.