--- George Sakkis <[EMAIL PROTECTED]> wrote: > > from itertools import count, ifilter > def sieve(): > seq = count(2) > while True: > p = seq.next() > seq = ifilter(p.__rmod__, seq) > yield p > > > I suspect that it violates your second rule though > :) >
I'm genuinely torn. The elegance of the solution far outweighs its esotericness. And I certainly can't complain about the choice of the problem (finding primes), since I included a much more pedestrian solution to the same problem on the very page that we're talking about. I do feel, however, like I want to order solutions by how long they are in line numbers, and if I stick to that rule, I do think that the solution above, while elegant, might be a little advanced as the seventh example of Python's simplicity. Is there a way to broaden the problem somehow, so that it can be a longer solution and further down on the page, and so that I can continue to enforce my somewhat arbitrary rule of ordering examples by how long they are? (I fully confess that my ordering rule unfairly penalizes short-and-sweet limitations, but I hope that *all* solutions are short-and-sweet, and this one certainly fits the bill.) ____________________________________________________________________________________ Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games. http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow -- http://mail.python.org/mailman/listinfo/python-list