integers

Bjorn Pettersen BPettersen at NAREX.com
Tue Jun 5 23:58:29 CEST 2001


> From: Joshua Marshall [mailto:jmarshal at mathworks.com]
> 
> Jonathan Gardner <gardner at cardomain.com> wrote:
> > Locke wrote:
> >> is there such thing as
> >> someint++
> >> or
> >> someint--
> >> or
> >> someint += 2
> >> in python??
> >> 
> >> it is a pain in the butt writing
> >> someint = someint + 1
> >> 
> >> Thanks!
> 
> > It's also a pain in the butt writing someint += 1 (Yes, I 
> know I am very 
> > lazy).
> 
> > What is the reason that python doesn't have increment or decrement 
> > operators?
> 
> Python isn't C - there's no reason to expect ++ or --.  And I'd
> personally be against adding these to the language, since += and -= do
> increment and decrement nicely.  Also, if ++ and -- were introduced
> people would probably expect them to be expressions (since they look
> like C's ++ and --).  This would be another mistake, in my opinion.  I
> like how Python keeps side-affecting language constructs in the realm
> of statements.

And introducing them now would change the meaning of:

  x--1

besides-Guido-doesn't-want-them'ly y'rs
-- bjorn




More information about the Python-list mailing list