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 <rep...@bugs.python.org> <http://bugs.python.org/issue20739> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com