[Python-ideas] If branch merging

Steven D'Aprano steve at pearwood.info
Sun Jun 7 07:25:00 CEST 2015

On Sat, Jun 06, 2015 at 11:40:55PM -0400, random832 at fastmail.us wrote:

> Well you could always go with if aisb = a == b.

No, that is a terrible design and a source of many bugs in languages 
that allow it.

if a = expr:  ...

Oops, I meant to compare a == expr, instead I assigned the result of the 
expression to a.

I'm not convinced that we need to allow name binding in if/elif clauses, 
but if we do, the Pythonic syntax would be

if a == b as aeqb: ...


More information about the Python-ideas mailing list