seeking deeper (language theory) reason behind Python design choice

Python python at bladeshadow.org
Sat May 12 22:42:13 EDT 2018


On Wed, May 09, 2018 at 03:09:18PM +1000, Chris Angelico wrote:
> On Wed, May 9, 2018 at 1:48 PM, Python <python at bladeshadow.org> wrote:
[much snippage...]
> >     flag = (spam == arg)
>
> That's not "side effects only". 

Yeah, I'll chalk that up to posting too late in the evening after
working too long a day...  

On Wed, May 09, 2018 at 12:46:07PM -0400, Dennis Lee Bieber wrote:
> On Tue, 8 May 2018 22:48:52 -0500, Python <python at bladeshadow.org>
> >    if spam == arg:
> 
> 	Mis-typing that as
> 
> 	if spam = arg:
> 
> IS the problem -- you've just changed the value bound to spam, and will
> then branch based upon the new value and not a comparison of values.

Yes, I'm well aware.  While I may have been momentarily confused about
the side effects question, if you read my post I was clearly not
confused about this.  Nor do I think anyone else who pposted in the
thread needed it explained.

Responding to this further would essentially just require me to
reiterate what I already wrote--I won't do that.  I'll simply maintain
that in my rather lenghty experience, this mistake has actually been
rather rare and has to my knowledge *never* caused a support issue
requiring a bug fix to production code in projects I've been
associated with.  It's a useful construction whose detriment has, IMO,
been completely overblown.




More information about the Python-list mailing list