f---ing typechecking

Szabolcs Nagy nszabolcs at gmail.com
Wed Feb 14 16:07:57 EST 2007


Sergey Dorofeev wrote:
> Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on
> win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> (1,)+[1]
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> TypeError: can only concatenate tuple (not "list") to tuple
> >>> [1]+(1,)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> TypeError: can only concatenate list (not "tuple") to list
> >>>
>
> Its ugly and boring.

what?
for me it works fine:

>>> (1,)+tuple([1])
(1, 1)
>>> [1]+list((1,))
[1, 1]

also

>>> L=[1]
>>> L.extend((1,))
>>> L
[1, 1]




More information about the Python-list mailing list