Bitten by my C/Java experience
BartC
bc at freeuk.com
Wed May 6 08:40:28 EDT 2015
On 06/05/2015 12:19, Gregory Ewing wrote:
> BartC wrote:
>
>> So why pretend that ++ and -- don't exist?
>
> Probably because Python would gain very little from
> having them.
>
> Main uses of ++ in C are things like integer for
> loops:
>
> for (i = 0; i < 10; i++) {...
>
> and stepping through arrays:
>
> a[i++] = b[j++];
>
> Python code usually operates at a higher level than
> that.
I think even in Python it is sometimes necessary to increment things (as
the OP did).
But I had in mind not implementing ++ and --, but detecting them and
issuing a warning, so forcing someone to type "+ +" or to use
parentheses, which is unlikely to be much of an imposition as how often
are two unary pluses going to be used together?
--
Bartc
More information about the Python-list
mailing list