On Oct 19, 2:30 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: [snip] > making your code easy to read and easy to maintain is far more important. > > for x in (2**i for i in xrange(10)): > print x > > will also print 1, 2, 4, 8, ... up to 1000.
I would say up to 512; perhaps your understanding of "up to" differs from mine. Easy to read? I'd suggest this: for i in xrange(10): print 2 ** i Cheers, John -- http://mail.python.org/mailman/listinfo/python-list