increment/decrement operators

D'Arcy J.M. Cain darcy at VybeNetworks.com
Sat Dec 5 09:41:15 EST 2015


On Sat, 5 Dec 2015 13:56:47 +0100
Robin Koch <robin.koch at 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 at Vex.Net VoIP: sip:darcy at VybeNetworks.com



More information about the Python-list mailing list