Bitten by my C/Java experience

Rustom Mody rustompmody at gmail.com
Tue May 5 12:24:10 EDT 2015


On Tuesday, May 5, 2015 at 6:50:29 PM UTC+5:30, BartC wrote:
> On 05/05/2015 09:19, Steven D'Aprano wrote:
> > On Tuesday 05 May 2015 08:02, BartC wrote:
> 
> >> (I think I would have picked up "++" and "--" as special tokens even if
> >> increment/decrement ops weren't supported. Just because they would
> >> likely cause errors through misunderstanding.)
> >
> > Just because C made a mistake, doesn't mean other languages have to
> > slavishly follow it.
> 
> I would have thought there was more rapport between the two languages. 
> Python is often implemented in C and extensions are often implemented in 
> C, suggesting there are quite a few people familiar with both, sometimes 
> in areas that are critical (ie. creating code that will affect thousands 
> of Python apps).

There are mistakes and there are mistakes.
Like there are crimes and crimes, some get community service, some get death sentence

> 
> So why pretend that ++ and -- don't exist? After all Python borrows "=", 
> "==" and "!=" from C.
> 
> (Writing a==b instead of a=b is less likely in Python than in a language 
> where a=b is an equality test rather than assignment. But I've used just 
> such a language where mistakenly writing a=b (which happens when 
> switching between languages) caused difficult-to-find bugs.

Yeah I happen to me in that minuscule minority that regards '= denotes 
assignment' a bigger mistake than ++

Interestingly K&R admitted to the fact that the precedences of C have errors;
in particular x&y == 0x1  groups wrong and so invariably requires brackets.
Unfortunately no such admission for the choice of the most ubiquitous operator =.



More information about the Python-list mailing list