Bitten by my C/Java experience

Rustom Mody rustompmody at gmail.com
Wed May 6 09:03:54 EDT 2015


On Wednesday, May 6, 2015 at 6:09:08 PM UTC+5:30, Antoon Pardon wrote:
> Op 05-05-15 om 18:24 schreef Rustom Mody:
> 
> > Yeah I happen to me in that minuscule minority that regards '= denotes 
> > assignment' a bigger mistake than ++
> 
> Nice to know I'm not alone. I Especially think it is a mistake, because
> it is then used as a reason for not allowing something like
> 
>   if a = b - 1:
> 
> arguing it would lead to some difficult bugs.
> 
> Which in my mind is arguing backwards. Either you think an assigment
> in a condition is useful or harmful. In the first case you then look
> for an assignment token or assignment syntax that is not that likely
> to lead to difficult to discover bugs instead of letting a possible
> misleading token or syntax prevent you from implementing something
> useful.
> 
> In the second case you just state why you think an assignment in a
> condition is harmful. No need to hide behind awkward syntax.

Nice to know we agree though I am not sure I agree with your agreement :-)

In APL assignment is ← goto is → [and of course equality and negated equality
are = and ≠ ]
But if you've seen hair-raising APL one-liners with multiple ← and even → stuffed in...

No on second thoughts we probably agree... I am just in the second camp:
assignment in conditions is trouble; no need for syntax to argue that



More information about the Python-list mailing list