Steven D'Aprano>That's a completely different question, so of course it has a completely different answer. Here is one way:<
Other versions without the creation of a list: for i in (2**n for n in xrange(6)): do_something(i) for i in (1<<n for n in xrange(6)): do_something(i) for i in xrange(6): do_something(i<<i) Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list