Python ++ Operator?

Chris Angelico rosuav at gmail.com
Fri Jul 15 10:06:30 CEST 2011


2011/7/15 Björn Lindqvist <bjourne at gmail.com>:
> Pre and post-increments are
> almost always confusing unless they are used as the counter-variable
> inside for-loops.

I agree that they're often confusing (i+++++j) but there are several
places where they're handy.

array[count++]=value;

or the more direct pointer management:

*ptr++=value;

However, Python doesn't work as close to the bare metal, so it doesn't
have such constructs.

ChrisA



More information about the Python-list mailing list