[New-bugs-announce] [issue20739] PEP 463 (except expression) implementation

Thomas Wouters report at bugs.python.org
Sun Feb 23 00:56:57 CET 2014


New submission from Thomas Wouters:

Here is a preliminary implementation of PEP 463, minus mandatory parentheses and with the most straightforward precedence rule: equal to if-expr -- which means this:

A if C else B except E: D

is parsed as

A if C else (B except E: D)

(because of associativity, not precedence) and not as

(A if C else B) except E: D

as suggested by the PEP with the hand-wavy words 'between lambda and if/else in precedence'. The latter is possible but means a little more hoop-jumping in the grammar.

The tests included are rudimentary (at the end of test_grammar.py) and could probably do with some fleshing out, partially as tests and partially to try out how the precedence rules work out in practice.

----------
components: Interpreter Core
files: exceptexpr.diff
keywords: patch
messages: 211973
nosy: twouters
priority: normal
severity: normal
stage: patch review
status: open
title: PEP 463 (except expression) implementation
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file34195/exceptexpr.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20739>
_______________________________________


More information about the New-bugs-announce mailing list