Thanks to everyone who replied.   Some of the methods presented where some I had thought of, others were new to me.   Particularly, I did not realize I could apply a slice to a list.   The for x in some_stuff[:value] form worked very well for my purposes.  I can also see I need to look into the itertools module and see what goodies are to be found there.<br>
<br>-Bill<br><br><br><br><div class="gmail_quote">On Sat, Sep 4, 2010 at 2:07 PM, Dave Angel <span dir="ltr">&lt;<a href="mailto:davea@ieee.org">davea@ieee.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><div></div><div class="h5"><br>
<br>
Bill Allen wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Say I have and iterable called some_stuff which is thousands of items in<br>
length and I am looping thru it as such:<br>
<br>
for x in some_stuff<br>
     etc...<br>
<br>
However, what if I want only to iterate through only the first ten items of<br>
some_stuff, for testing purposes.  Is there a concise way of specifying that<br>
in the for statement line?<br>
<br>
<br>
-Bill<br>
<br>
  <br>
</blockquote></div></div>
You could use islice()<br>
<br>
import itertools<br>
for x in itertools.islice(some_stuff, 0, 10)<br>
   print x<br>
<br>
DaveA<br>
<br>
<br>
</blockquote></div><br>