non-copy slices

Themis Bourdenas t.bourdenas07 at imperial.ac.uk
Thu Nov 19 12:55:26 EST 2009


On Thu, Nov 19, 2009 at 2:44 PM, Ethan Furman <ethan at stoneleaf.us> wrote:

> Please don't top post.  :)
>
> So "shallow copy" == "new label created for existing object".
>
> So is your desired behavior to write back to the original list if your
> sub-list is modified?  In other words, you are creating a window onto an
> existing list?  If not, what would happen when a sublist element was
> modified (or deleted, or appended, or ...)?
>
> ~Ethan~
> --
> http://mail.python.org/mailman/listinfo/python-list
>

Yes a window / view on the existing list describes it best. So every
modification you make in this view is actually modifying the original list
accordingly. Blist that was suggested in a previous email in the thread
seems lightweight but it does create a new list when a modification is made.
In any case, I've already implemented the object myself and I can post it if
you care to have a look, but I was just wondering if there was already
something in the standard library.

Themis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091119/45ad028c/attachment-0001.html>


More information about the Python-list mailing list