Postfix/Prefix Operators (++,--)
Jp Calderone
exarkun at intarweb.us
Fri Jun 6 13:18:12 EDT 2003
On Fri, Jun 06, 2003 at 04:04:17PM +0000, Joshua Marshall wrote:
> 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
So name++ would be an -expression- that -rebinds- a name.
Fantastic. Just what Python needs. More semantic garbage.
--1--
Jp
--
http://catandgirl.com/view.cgi?44
More information about the Python-list
mailing list