Bitten by my C/Java experience
BartC
bc at freeuk.com
Mon May 4 18:02:57 EDT 2015
On 04/05/2015 16:20, Cecil Westerhof wrote:
> Potential dangerous bug introduced by programming in Python as if it
> was C/Java. :-(
> I used:
> ++tries
> that has to be:
> tries += 1
I think I've come across that. It doesn't mind ++ so people are likely
to be assume that increment works as in other languages.
I guess it just means +(+(a)).
But in that case, what meaning does:
a
or
a+b
have in Python? If they were function calls: a() or (a+b)(), then that's
clear enough. But a+b doesn't do anything!
(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.)
--
Bartc
More information about the Python-list
mailing list