<div>Hi,</div><div><br></div>sth == something :) sorry for the abbreviation. I'm talking about the shallow copy, still it's a copy. Unnecessary in my case and the worst part in my scenario is the creation (allocation) and deletion of a very large number of lists of moderate size (a few hundred objects) generated due to slices, while I only need to have a restricted view on the original list. The islice class partially solves the problem as I mentioned in the previous emails.<div>

<br></div><div>Cheers,<br clear="all">Themis<br>
<br><br><div class="gmail_quote">On Wed, Nov 18, 2009 at 3:44 PM, Ethan Furman <span dir="ltr"><<a href="mailto:ethan@stoneleaf.us">ethan@stoneleaf.us</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div><div></div><div class="h5"><a href="mailto:tbourden@doc.ic.ac.uk">tbourden@doc.ic.ac.uk</a> wrote:<br>
> Hi,<br>
><br>
> I was looking for a facility similar to slices in python library that<br>
> would avoid the implicit creation of a new list and copy of elements<br>
> that is the default behaviour. Instead I'd rather have a lazy iteratable<br>
> object on the original sequence. Well, in the end I wrote it myself but<br>
> I was wondering if I missed sth in the library. If I didn't is there a<br>
> particular reason there isn't sth like that? I find it hard to believe<br>
> that all slice needs have strictly copy semantics.<br>
><br>
> Cheers,<br>
> Themis<br>
<br>
</div></div>Two questions:  1) What is "sth"?  and 2), What copy?<br>
<br>
Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)]<br>
In [1]: class dummy(object):<br>
    ...:     pass<br>
    ...:<br>
<br>
In [2]: a = dummy()<br>
In [3]: b = dummy()<br>
In [4]: c = dummy()<br>
In [5]: d = dummy()<br>
In [6]: e = dummy()<br>
In [7]: list1 = [a, b, c, d, e]<br>
In [8]: list1<br>
Out[8]:<br>
[<__main__.dummy object at 0x0130C510>,<br>
  <__main__.dummy object at 0x013F1A50>,<br>
  <__main__.dummy object at 0x00A854F0>,<br>
  <__main__.dummy object at 0x00A7EF50>,<br>
  <__main__.dummy object at 0x00A7E650>]<br>
<br>
In [9]: list2 = list1[1:3]<br>
In [10]: list2<br>
Out[10]:<br>
[<__main__.dummy object at 0x013F1A50>,<br>
  <__main__.dummy object at 0x00A854F0>]<br>
<br>
In [11]: list2[0] is list1[1]<br>
Out[11]: *True*<br>
In [12]: list2[1] is list1[2]<br>
Out[12]: *True*<br>
<br>
No copying of items going on here.  What do you get?<br>
<br>
~Ethan~<br>
<font color="#888888">--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></blockquote></div><br></div>