Copyright (c) Hyperion Entertainment and contributors.
Difference between revisions of "AmigaOS Manual: Reserved Python Words"
Jump to navigation
Jump to search
(Table of keywords) |
(Added keyword descriptions) |
||
Line 17: | Line 17: | ||
| continue || |
| continue || |
||
|- |
|- |
||
− | | def || |
+ | | def || Defines a function |
|- |
|- |
||
− | | del || |
+ | | del || Deletes an object |
|- |
|- |
||
| elif || |
| elif || |
||
Line 33: | Line 33: | ||
| finally || |
| finally || |
||
|- |
|- |
||
− | | for || |
+ | | for || Creates a for loop |
|- |
|- |
||
− | | from || |
+ | | from || Imports a part of a module |
|- |
|- |
||
− | | global || |
+ | | global || Declares a global variable |
|- |
|- |
||
| if || |
| if || |
||
|- |
|- |
||
− | | import || |
+ | | import || Imports a module |
|- |
|- |
||
+ | | in || Checks if a value is present in an array |
||
− | | in || |
||
|- |
|- |
||
− | | is || |
+ | | is || Tests if two values are equal |
|- |
|- |
||
− | | lambda || |
+ | | lambda || Defines an anonymous function |
|- |
|- |
||
| None || |
| None || |
||
Line 55: | Line 55: | ||
| or || A logical operator |
| or || A logical operator |
||
|- |
|- |
||
− | | pass || |
+ | | pass || Does nothing, a null statement |
|- |
|- |
||
| print || |
| print || |
||
|- |
|- |
||
− | | raise || |
+ | | raise || Raises an exception |
|- |
|- |
||
− | | return || |
+ | | return || Exits a function and returns a value |
|- |
|- |
||
| True || |
| True || |
||
Line 67: | Line 67: | ||
| try || |
| try || |
||
|- |
|- |
||
− | | while || |
+ | | while || Creates a while loop |
|- |
|- |
||
| with || |
| with || |
Revision as of 10:39, 21 August 2022
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 |
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.