Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #73868
| X-Received | by 10.182.22.65 with SMTP id b1mr1020536obf.10.1404355187883; Wed, 02 Jul 2014 19:39:47 -0700 (PDT) |
|---|---|
| X-Received | by 10.140.101.79 with SMTP id t73mr30430qge.4.1404355187849; Wed, 02 Jul 2014 19:39:47 -0700 (PDT) |
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!hn18no2244939igb.0!news-out.google.com!a8ni6410qaq.1!nntp.google.com!w8no5412741qac.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
| Newsgroups | comp.lang.python |
| Date | Wed, 2 Jul 2014 19:39:47 -0700 (PDT) |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=82.245.68.143; posting-account=J_U-0woAAACrUCMCI_QdLAKny8A2zeDX |
| NNTP-Posting-Host | 82.245.68.143 |
| User-Agent | G2/1.0 |
| MIME-Version | 1.0 |
| Message-ID | <f1cd7efe-d628-4e96-9ed3-79d9a212f768@googlegroups.com> (permalink) |
| Subject | TypeError expected in an augmented assignment |
| From | candide <c.candide@laposte.net> |
| Injection-Date | Thu, 03 Jul 2014 02:39:47 +0000 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Xref | csiph.com comp.lang.python:73868 |
Show key headers only | View raw
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