List slice assignment and custom sequences

Ronald Oussoren oussoren at cistron.nl
Tue Nov 5 12:29:09 EST 2002


On Tuesday, Nov 5, 2002, at 15:03 Europe/Amsterdam, Michael Hudson 
wrote:

> Ronald Oussoren <oussoren at cistron.nl> writes:
>
>> No, I want to replace part of a sequence by another sequence. I don't
>> understand _why_ the RHS must be a list if the LHS is one.
>
> Because Objects/listobject.c:list_ass_slice pokes directly into the
> object passed on the RHS.
>
> A patch to change this would have some chance of getting accepted;
> wouldn't like to guess what, but I'd hazard non-zero.
I sure hope so. I've posted a bug+patch at SF for a related problem: 
With the introduction of new-style classes 'isinstance(obj, list)' no 
longer guarantees that you can savely poke in the RHS instead of using 
the __getitem__ accessor function.

Ronald





More information about the Python-list mailing list