[Python-3000] Possible Duck Typing Problem in Python 2.5?

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Dec 10 00:46:51 CET 2007


hashcollision wrote:

> TypeError: can only concatenate list (not "instance") to list
> 
> IMHO, this is a problem. Is it? If so, I suggest that it be fixed in python 3000.

I seem to remember this came up before, and was considered
not to be something that needed changing.

How would you decide what type the result should be?
Who's to say it should be a list and not an X?
Better to be explicit:

   l2 = l + list(x)

or if in-place modification is acceptable,

   l.extend(x)

--
Greg



More information about the Python-3000 mailing list