0% found this document useful (0 votes)
35 views

2.3.1 Keywords: Python Reference Manual

This document summarizes Python keywords that cannot be used as ordinary identifiers and must be spelled exactly as written. It lists keywords such as and, del, from, not, while, as, elif, global, or, yield, break, except, import, print, class, exec, in, raise, continue, finally, is, return, def, for, lambda, try. It notes that None became a constant in Python 2.4 and you cannot assign a different object to it. As and with are only keywords when the with_statement future feature is enabled starting in Python 2.6.

Uploaded by

chhetribharat08
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

2.3.1 Keywords: Python Reference Manual

This document summarizes Python keywords that cannot be used as ordinary identifiers and must be spelled exactly as written. It lists keywords such as and, del, from, not, while, as, elif, global, or, yield, break, except, import, print, class, exec, in, raise, continue, finally, is, return, def, for, lambda, try. It notes that None became a constant in Python 2.4 and you cannot assign a different object to it. As and with are only keywords when the with_statement future feature is enabled starting in Python 2.6.

Uploaded by

chhetribharat08
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

5/22/2018 2.3.

1 Keywords

Python Reference Manual

2.3.1 Keywords
The following identifiers are used as reserved words, or keywords of the language, and cannot be used as
ordinary identifiers. They must be spelled exactly as written here:

and del from not while


as elif global or with
assert else if pass yield
break except import print
class exec in raise
continue finally is return
def for lambda try

Changed in version 2.4: None became a constant and is now recognized by the compiler as a name for the built-
in object None. Although it is not a keyword, you cannot assign a different object to it.

Changed in version 2.5: Both as and with are only recognized when the with_statement future feature has
been enabled. It will always be enabled in Python 2.6. See section 7.5 for details. Note that using as and with
as identifiers will always issue a warning, even when the with_statement future directive is not in effect.

Release 2.5.4, documentation updated on 23rd December, 2008.


See About this document... for information on suggesting changes.

https://docs.python.org/2.5/ref/keywords.html 1/1

You might also like