Copyright (c) Hyperion Entertainment and contributors.
AmigaOS Manual: Reserved Python Words: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
Added keyword descriptions |
Added keyword descriptions |
||
| Line 23: | Line 23: | ||
| elif || |
| elif || |
||
|- |
|- |
||
| else || Defines actions that are executed when if condition is False. See if. When used with exception handler, defines actions that are executed when there there was no error. See try. |
|||
| else || |
|||
|- |
|- |
||
| except || Defines an error handler for an exception handler. See try. |
|||
| except || |
|||
|- |
|- |
||
| exec || |
| exec || |
||
| Line 31: | Line 31: | ||
| False || |
| False || |
||
|- |
|- |
||
| finally || Defines actions for exception handler that are executed always. See try. |
|||
| finally || |
|||
|- |
|- |
||
| for || Creates a for loop |
| for || Creates a for loop |
||
| Line 39: | Line 39: | ||
| global || Declares a global variable |
| global || Declares a global variable |
||
|- |
|- |
||
| if || Defines actions that are executed when if condition is True. |
|||
| if || |
|||
|- |
|- |
||
| import || Imports a module |
| import || Imports a module |
||
| Line 65: | Line 65: | ||
| True || |
| True || |
||
|- |
|- |
||
| try || Defines an exception handler (tests a block of code for errors). See except, finally, and else. |
|||
| try || |
|||
|- |
|- |
||
| while || Creates a while loop |
| while || Creates a while loop |
||
Revision as of 09:56, 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 | Defines actions that are executed when if condition is False. See if. When used with exception handler, defines actions that are executed when there there was no error. See try. |
| except | Defines an error handler for an exception handler. See try. |
| exec | |
| False | |
| finally | Defines actions for exception handler that are executed always. See try. |
| for | Creates a for loop |
| from | Imports a part of a module |
| global | Declares a global variable |
| if | Defines actions that are executed when if condition is True. |
| 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 | Defines an exception handler (tests a block of code for errors). See except, finally, and else. |
| 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.