SimplePrograms challenge

Steven Bethard steven.bethard at
Wed Jun 13 01:20:36 CEST 2007

Steve Howell wrote:
> --- Steven Bethard <steven.bethard at> wrote:
>> How about we just comment it better?
>> import itertools
>> def iter_primes():
>>      # an iterator of all numbers between 2 and +infinity
>>      numbers = itertools.count(2)
> Actually, just one small caveat--I'd still want the
> program to print out the results.  I think I've
> followed that convention for all the other programs.  

Good point. Adding something as simple as::

     # print the first 100 primes
     for prime in itertools.islice(iter_primes(), 100):
         print prime

to the end should make it a full-fledged program.


More information about the Python-list mailing list