Re: TypeError expected in an augmented assignment

2014-07-03 Thread candide
seq = [1,2] seq.extend((3,4)) OK, this feature is referenced in the Python Library reference here : https://docs.python.org/3.2/library/stdtypes.html#typesseq-mutable not thoroughly referenced but, anyway, referenced. seq+= {5, 6} # the order of extending is not determined

Re: TypeError expected in an augmented assignment

2014-07-03 Thread Chris Angelico
On Thu, Jul 3, 2014 at 5:51 PM, candide c.cand...@laposte.net wrote: Good and interesting observation. But I can't find out where this feature is referenced in the Language/Library Reference. Because, as my first post explains, augmented assignment performs the binary operation associated to

Re: TypeError expected in an augmented assignment

2014-07-03 Thread candide
From that link: An augmented assignment expression like x += 1 can be rewritten as x = x + 1 to achieve a similar, but not exactly equal effect. In the augmented version, x is only evaluated once. Also, when possible, the actual operation is performed in-place, meaning that

Re: TypeError expected in an augmented assignment

2014-07-03 Thread Mark Lawrence
On 03/07/2014 10:35, candide wrote: From that link: An augmented assignment expression like x += 1 can be rewritten as x = x + 1 to achieve a similar, but not exactly equal effect. In the augmented version, x is only evaluated once. Also, when possible, the actual operation is

TypeError expected in an augmented assignment

2014-07-02 Thread candide
An hybrid list-tuple concatenation is not allowed []+(1, 2) Traceback (most recent call last): File stdin, line 1, in module TypeError: can only

Re: TypeError expected in an augmented assignment

2014-07-02 Thread Terry Reedy
On 7/2/2014 10:39 PM, candide wrote: 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