f---ing typechecking
Sergey Dorofeev
sergey at fidoman.ru
Wed Feb 14 16:50:03 EST 2007
"James Stroud" <jstroud at mbi.ucla.edu> wrote in message
news:eqvuo1$kk7$1 at zinnia.noc.ucla.edu...
>>>>>[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.
>
> Agreed. This would be similar to:
>
> py> 1 + 1.0
>
> Traceback: can only add int to int. Etc.
>
> But then again, the unimaginative defense would be that it wouldn't be
> python if you could catentate a list and a tuple.
Maybe, but I don't think that it is best side of the languague.
If we want constant objects like tuple why not to specify it explicitly?
If we want lists as dict keys, why not to use copy-on-write?
More information about the Python-list
mailing list