Tuple slices

George Sakkis gsakkis at rutgers.edu
Mon Jan 24 17:54:26 EST 2005


"Terry Reedy" <tjreedy at udel.edu> wrote in message
news:mailman.1226.1106605134.22381.python-list at python.org...
>
> Aside from the problem of not being able to delete the underlying object,
> the view object for a tuple would have to be a new type of object with a
> new set of methods.

It *could*, but it doesn't have to. One can represent a view as essentially an object with a pointer
to a memory buffer and a (start,stop,step) triple. Then a "real tuple" is just a "view" with the
triple being (0, len(sequence), 1).

George





More information about the Python-list mailing list