[docs] [issue22243] Documentation on try statement incorrectly implies target of except clause can be any assignable expression
Michael Williamson
report at bugs.python.org
Thu Aug 21 17:55:55 CEST 2014
New submission from Michael Williamson:
In the docs for the try statement [1], part of the grammar is:
try1_stmt ::= "try" ":" suite
("except" [expression ["as" target]] ":" suite)+
["else" ":" suite]
["finally" ":" suite]
The `target` rule allows any assignable expression (identifier, attributes, etc.). However, CPython appears to only allow identifiers as a target. The abstract grammar in the ast module [2] appears to confirm this.
[1] https://docs.python.org/3.4/reference/compound_stmts.html#the-try-statement
[2] https://docs.python.org/3.4/library/ast.html#abstract-grammar
----------
assignee: docs at python
components: Documentation
messages: 225611
nosy: docs at python, mwilliamson
priority: normal
severity: normal
status: open
title: Documentation on try statement incorrectly implies target of except clause can be any assignable expression
versions: Python 3.4, Python 3.5
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22243>
_______________________________________
More information about the docs
mailing list