[ x for x in xrange(10) when p(x) ]

bonono at gmail.com bonono at gmail.com
Wed Nov 9 23:18:03 EST 2005


George Sakkis wrote:
> >>> list(takewhile(p, xrange(10000000)))
> [0, 1]
thanks. that is what I am doing now, in a more generic form :

takewhile(p, (x for x in xrange(100000000)))




More information about the Python-list mailing list