Bengt Richter wrote:
You can bail out of a generator expression with a raise-StopIteration
expression spelled iter([]).next() ;-)
>>> list(show(x) for x in xrange(20) if x<8 or iter([]).next() or True)
0 1 2 3 4 5 6 7
[0, 1, 2, 3, 4, 5, 6, 7]
This is both neat and incredibly arcane at the same time :)
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---------------------------------------------------------------
http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list