non-copy slices

tbourden at doc.ic.ac.uk tbourden at doc.ic.ac.uk
Wed Nov 18 16:52:47 CET 2009


Ahhh yes! that's exactly it. Thanks for pointing out!

Themis


On Wed, Nov 18, 2009 at 3:44 PM, Tim Golden <mail at timgolden.me.uk> wrote:

> tbourden at doc.ic.ac.uk wrote:
> > Hi,
> >
> > I was looking for a facility similar to slices in python library that
> would
> > avoid the implicit creation of a new list and copy of elements that is
> the
> > default behaviour. Instead I'd rather have a lazy iteratable object on
> the
> > original sequence. Well, in the end I wrote it myself but I was wondering
> if
> > I missed sth in the library. If I didn't is there a particular reason
> there
> > isn't sth like that? I find it hard to believe that all slice needs have
> > strictly copy semantics.
>
> I suspect that itertools is your friend, specifically itertools.islice
>
> TJG
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091118/61257ddf/attachment.html>


More information about the Python-list mailing list