Postfix/Prefix Operators (++,--)
Joshua Marshall
joshway_without_spam at myway.com
Fri Jun 6 12:04:17 EDT 2003
Peter Hansen <peter at engcorp.com> wrote:
...
>> ++/-- can be added to Python, and could act in a way that wouldn't
>> surprise C or Java programmers. There really isn't any conceptual
>> difference between references to immutabe ints and C/Java primitive
>> ints.
> How would the error generated when the C or Java programmer wrote
> the following code not surprise him or her?
> c = 1
> a = c++
I wouldn't design ++ to error in this case:
>>> c = 1
>>> a = c++
>>> a
1
>>> c
2
More information about the Python-list
mailing list