[Python-Dev] PEP 463: Exception-catching expressions
zuo at chopin.edu.pl
Mon Feb 24 01:36:46 CET 2014
23.02.2014 19:51, Stefan Behnel wrote:
> I see a risk of interfering with in-place assignment operators, e.g.
> x /= y except ZeroDivisionError: 1
> might not do what one could expect, because (as I assume) it would
> differently from
> x = x / y except ZeroDivisionError: 1
Please note that:
x /= y if y else 0
also behaves differently from
x = x / y if y else 0
Anyway, enclosing in parens would make that expicit and clear.
More information about the Python-Dev