List slice assignment and custom sequences

Michael Hudson mwh at python.net
Tue Nov 5 13:15:49 EST 2002


Ronald Oussoren <oussoren at cistron.nl> writes:

> 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.

Well, that's gone in too, in effect.  Guido seems to be in a receptive
mood today!  It would be fun seeing what changes I could sneak in,
except I'm going to the pub :)

against-drinking-and-committing-ly y'rs
M.

-- 
  Two things I learned for sure during a particularly intense acid
  trip in my own lost youth: (1) everything is a trivial special case
  of something else; and, (2) death is a bunch of blue spheres.
                                             -- Tim Peters, 1 May 1998



More information about the Python-list mailing list