2009/7/12 Cameron Pulsford <cameron.pulsf...@gmail.com>: > My question is, is it possible to combine those two loops? The primes > generator I wrote finds all primes up to n, except for 2, 3 and 5, so I must > check those explicitly. Is there anyway to concatenate the hard coded list > of [2,3,5] and the generator I wrote so that I don't need two for loops that > do the same thing?
itertools.chain([2, 3, 5], primes) is what you're looking for, I think. Vil. -- http://mail.python.org/mailman/listinfo/python-list