On 2006-10-10, Paul Rubin <http> wrote:
> "Fredrik Lundh" <[EMAIL PROTECTED]> writes:
>> or for the perhaps-overly-clever hackers,
>> 
>>     for x in iter(lambda: foo() or None, None):
>>         process(x)
>
> for x in takewhile(foo() for _ in repeat(None)):
>    process (x)

>>> for x in takewhile(foo() for _ in repeat(None)):
...   print x
... 
Traceback (most recent call last):
 File "<stdin>", line 1, in ?
TypeError: takewhile expected 2 arguments, got 1

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to