Re: TypeError: can only concatenate list (not tuple) to list

2010-01-04 Thread Chris Rebert
On Sun, Jan 3, 2010 at 11:51 PM, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: This py [1,2,3] + (4,5) Traceback (most recent call last):  File stdin, line 1, in module TypeError: can only concatenate list (not tuple) to list Given that tuples are sometimes used as a poor man's object

Re: TypeError: can only concatenate list (not tuple) to list

2010-01-04 Thread Steven D'Aprano
On Mon, 04 Jan 2010 04:59:02 -0300, Gabriel Genellina wrote: Is there any reason for this error? Apart from nobody cared to write the code Yes, because such implicit conversions would be a bad idea. py [1,2,3] + (4,5) What result are you expecting? A list or a tuple? Traceback (most

Re: TypeError: can only concatenate list (not tuple) to list

2010-01-04 Thread Gabriel Genellina
En Mon, 04 Jan 2010 04:58:54 -0300, Chris Rebert c...@rebertia.com escribió: On Sun, Jan 3, 2010 at 11:51 PM, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: py [1,2,3] + (4,5) Traceback (most recent call last): File stdin, line 1, in module TypeError: can only concatenate list (not tuple)

Re: TypeError: can only concatenate list (not tuple) to list

2010-01-04 Thread David Williams
Is there any reason for this error? Apart from nobody cared to write the code py [1,2,3] + (4,5) Traceback (most recent call last): File stdin, line 1, in module TypeError: can only concatenate list (not tuple) to list In-place addition += does work: py a = [1,2,3] py a += (4,5)

Re: TypeError: can only concatenate list (not tuple) to list

2010-01-04 Thread David Williams
Is there any reason for this error? Apart from nobody cared to write the code py [1,2,3] + (4,5) Traceback (most recent call last): File stdin, line 1, in module TypeError: can only concatenate list (not tuple) to list In-place addition += does work: py a = [1,2,3] py a += (4,5)

Re: TypeError: can only concatenate list (not tuple) to list

2010-01-04 Thread Gabriel Genellina
En Mon, 04 Jan 2010 05:24:56 -0300, David Williams da...@bibliolabs.com escribió: py [1,2,3] + (4,5) Traceback (most recent call last): File stdin, line 1, in module TypeError: can only concatenate list (not tuple) to list In-place addition += does work: py a = [1,2,3] py a += (4,5) py

Re: TypeError: can only concatenate list (not tuple) to list

2010-01-04 Thread Gabriel Genellina
En Mon, 04 Jan 2010 05:22:44 -0300, Steven D'Aprano ste...@remove.this.cybersource.com.au escribió: On Mon, 04 Jan 2010 04:59:02 -0300, Gabriel Genellina wrote: Is there any reason for this error? Apart from nobody cared to write the code Yes, because such implicit conversions would be a

Re: TypeError: can only concatenate list (not tuple) to list

2010-01-04 Thread Steven D'Aprano
On Mon, 04 Jan 2010 06:27:48 -0300, Gabriel Genellina wrote: En Mon, 04 Jan 2010 05:24:56 -0300, David Williams da...@bibliolabs.com escribió: py [1,2,3] + (4,5) Traceback (most recent call last): File stdin, line 1, in module TypeError: can only concatenate list (not tuple) to list

Re: TypeError: can only concatenate list (not tuple) to list

2010-01-04 Thread Jean-Michel Pichavant
Gabriel Genellina wrote: En Mon, 04 Jan 2010 05:24:56 -0300, David Williams da...@bibliolabs.com escribió: py [1,2,3] + (4,5) Traceback (most recent call last): File stdin, line 1, in module TypeError: can only concatenate list (not tuple) to list In-place addition += does work: py a =

Re: TypeError: can only concatenate list (not tuple) to list

2010-01-04 Thread r0g
Gabriel Genellina wrote: En Mon, 04 Jan 2010 04:58:54 -0300, Chris Rebert c...@rebertia.com escribió: On Sun, Jan 3, 2010 at 11:51 PM, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: py [1,2,3] + (4,5) Traceback (most recent call last): File stdin, line 1, in module TypeError: can only

Re: TypeError: can only concatenate list (not tuple) to list

2010-01-04 Thread Steven D'Aprano
On Tue, 05 Jan 2010 00:52:56 +, r0g wrote: I'd be strongly inclined to think the result would be the sequence on the left with the data from the second sequence appended to it. What's wrong with a little duck typing here eh? That's not the existing behaviour. List concatenation doesn't

Re: TypeError: can only concatenate list (not tuple) to list

2010-01-04 Thread r0g
Steven D'Aprano wrote: On Tue, 05 Jan 2010 00:52:56 +, r0g wrote: I'd be strongly inclined to think the result would be the sequence on the left with the data from the second sequence appended to it. What's wrong with a little duck typing here eh? OK, I hadn't read all the other