M
Mike Kent
For Python 2.5 and new-style classes, what special method is called
for mylist[2:4] = seq and for del mylist[2:4] (given that mylist is a
list, and seq is some sequence)?
I'm trying to subclass list, and I'm having trouble determining what
special methods I have to override in my class for the above two
operations. From my testing, it seems to be __setslice__ for both,
but the docs say __setslice__ and brethren are deprecated. I would
have thought that __setitem__ and __delitem__ would be what was
called, but again, my testing says otherwise.
for mylist[2:4] = seq and for del mylist[2:4] (given that mylist is a
list, and seq is some sequence)?
I'm trying to subclass list, and I'm having trouble determining what
special methods I have to override in my class for the above two
operations. From my testing, it seems to be __setslice__ for both,
but the docs say __setslice__ and brethren are deprecated. I would
have thought that __setitem__ and __delitem__ would be what was
called, but again, my testing says otherwise.