Hi,

What do I need to do to make the code below work as expected:

class str2(str):

        def __setitem__(self, i, y):
                assert type(y) is str
                assert type(i) is int
                assert i < len(self)

                self = self[:i] + y + self[1+i:]


a = str2('123')
a[1] = '1'
print a
123


The print statement should return 113

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

Reply via email to