(original) (raw)
On Mon, Jan 19, 2009 at 10:37 AM, Gerald Britton <gerald.britton@gmail.com> wrote:
I'm pretty sure the extra cost of evaluating the lambda at each step is tiny compared to the cost of the sieve, so I don't you can make a convincing argument on performance.
Also, you know the latter is actually fewer characters, right? :-)
prime = (p for p in sieve() while p < 1000)
prime = takewhile(lamda p:p<1000, sieve())
I'm pretty sure the extra cost of evaluating the lambda at each step is tiny compared to the cost of the sieve, so I don't you can make a convincing argument on performance.
Also, you know the latter is actually fewer characters, right? :-)
--
Daniel Stutzbach, Ph.D.
President, Stutzbach Enterprises, LLC