SimplePrograms challenge

Steve Howell showell30 at yahoo.com
Tue Jun 12 19:42:23 EDT 2007


--- Steven Bethard <steven.bethard at gmail.com> wrote:
>      # print the first 100 primes
>      for prime in itertools.islice(iter_primes(),
> 100):
>          print prime
> 

Sure.  FWIW, in the example I posted, I kept the
output loop a little more pedestrian (using an
if/break idiom), and I printed primes less than 100,
not the first 100 primes.

I still find itertools a little magical at times, so I
want to keep it limited to places where it really
simplifies an algorithm.



       
____________________________________________________________________________________
Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online.
http://smallbusiness.yahoo.com/webhosting 



More information about the Python-list mailing list