Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #73868
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2014-07-02 19:39 -0700 |
| Message-ID | <f1cd7efe-d628-4e96-9ed3-79d9a212f768@googlegroups.com> (permalink) |
| Subject | TypeError expected in an augmented assignment |
| From | candide <c.candide@laposte.net> |
An hybrid list-tuple concatenation is not allowed >>> []+(1, 2) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: can only concatenate list (not "tuple") to list >>> hence I was expecting (*) that the following code raises a TypeError : >>> x = [] >>> x += (1, 2) >>> x [1, 2] >>> Any explanation ? (*) as the docs states, the augmented assignment is supposed to perform the concatenation : An augmented assignment (...) performs the binary operation specific to the type of assignment on the two operands (...)
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
TypeError expected in an augmented assignment candide <c.candide@laposte.net> - 2014-07-02 19:39 -0700
Re: TypeError expected in an augmented assignment Terry Reedy <tjreedy@udel.edu> - 2014-07-02 22:57 -0400
Re: TypeError expected in an augmented assignment candide <c.candide@laposte.net> - 2014-07-03 00:51 -0700
Re: TypeError expected in an augmented assignment Chris Angelico <rosuav@gmail.com> - 2014-07-03 18:36 +1000
Re: TypeError expected in an augmented assignment candide <c.candide@laposte.net> - 2014-07-03 02:35 -0700
Re: TypeError expected in an augmented assignment Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-07-03 13:43 +0100
csiph-web