"Fredrik Lundh" <fredrik at pythonware.com> writes: > or for the perhaps-overly-clever hackers, > > for x in iter(lambda: foo() or None, None): > process(x) for x in takewhile(bool, (foo() for _ in repeat(None))): process(x) Meh, both are ugly.