Half-baked idea: list comprehensions with "while"

Paul Rubin no.email at nospam.invalid
Thu Apr 26 13:48:58 EDT 2012


Roy Smith <roy at panix.com> writes:
> x = [a for a in iterable while a]

from itertools import takewhile

x = takewhile(bool, a)



More information about the Python-list mailing list