operator overloading + - / * = etc...

Antoon Pardon apardon at forel.vub.ac.be
Tue Oct 10 13:07:15 CEST 2006


On 2006-10-10, Paul Rubin <http> wrote:
> "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(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




More information about the Python-list mailing list