Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #100039

Re: increment/decrement operators

From "D'Arcy J.M. Cain" <darcy@VybeNetworks.com>
Newsgroups comp.lang.python
Subject Re: increment/decrement operators
Date 2015-12-05 09:41 -0500
Organization Vybe Networks Inc.
Message-ID <mailman.224.1449326482.14615.python-list@python.org> (permalink)
References <dcg4apF3gq3U1@mid.individual.net> <n3umug$f0$1@news.albasani.net>

Show all headers | View raw


On Sat, 5 Dec 2015 13:56:47 +0100
Robin Koch <robin.koch@t-online.de> wrote:
> x += y works. (Well, it should.)

It does, even on objects other than numbers.

>>> x = "abc"
>>> y = "def"
>>> x += y
>>> x
'abcdef'

> x++ doesn't.

No but it's just a special case of the above.

>>> x = 1
>>> x += 1
>>> x
2

-- 
D'Arcy J.M. Cain
Vybe Networks Inc.
http://www.VybeNetworks.com/
IM:darcy@Vex.Net VoIP: sip:darcy@VybeNetworks.com

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

increment/decrement operators Tony van der Hoff <tony@vanderhoff.org> - 2015-12-05 12:40 +0000
  Re: increment/decrement operators Robin Koch <robin.koch@t-online.de> - 2015-12-05 13:56 +0100
    Re: increment/decrement operators Tony van der Hoff <tony@vanderhoff.org> - 2015-12-05 14:14 +0000
    Re: increment/decrement operators "D'Arcy J.M. Cain" <darcy@VybeNetworks.com> - 2015-12-05 09:41 -0500
    Re: increment/decrement operators Terry Reedy <tjreedy@udel.edu> - 2015-12-05 10:43 -0500
      Re: increment/decrement operators BartC <bc@freeuk.com> - 2015-12-05 17:18 +0000
        Re: increment/decrement operators Ian Kelly <ian.g.kelly@gmail.com> - 2015-12-07 17:24 -0700

csiph-web