On Fri, 12 Dec 2008 07:56:58 -0800, sturlamolden wrote:

> On Dec 12, 4:55 pm, sturlamolden <sturlamol...@yahoo.no> wrote:
> 
>> def __setitem__(self, index, value):
>>    if _buf[index] is not value: # given that _buf is the tuple's
>> internal buffer
>>       raise TypeError, 'tuple' object does not support item
>> assignment
> 
> blæh, that should be self._buf[index]

But then the error message is not true anymore because tuples *would* 
support item assignment when the old and new value are the same.  Which 
leads to strange things like code that may or may not raise that 
exception, depending on implementation details:

t = (1, 2)
t[0] = 1   # Maybe okay -- maybe not.
t[1] += 0  # Same here.

I'd find that quite odd.

Ciao,
        Marc 'BlackJack' Rintsch

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to