[Python-ideas] If branch merging

s.krah stefan at bytereef.org
Sun Jun 7 12:20:29 CEST 2015



Steven D'Aprano <steve at pearwood.info> wrote:

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. 
 
In C I've mistyped this perhaps twice, in which case you get a compiler
warning.

It's a complete non-issue (and the construct *is* very handy).

 
Stefan Krah


_______________________________________________ 
Python-ideas mailing list 
Python-ideas at python.org 
https://mail.python.org/mailman/listinfo/python-ideas 
Code of Conduct: http://python.org/psf/codeofconduct/ 




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150607/d58efd8c/attachment.html>


More information about the Python-ideas mailing list