On Sat, 7 Jan 2017 07:06 am, Wolfgang Maier wrote:

> On 1/6/2017 15:04, Peter Otten wrote:
[...]
>> How would you implement stopmin()?
>>
> 
> How about:
> 
> def stopmin (iterable, key, stop):
>      def take_until ():
>          for e in iterable:
>              yield e
>              if key(e) <= stop:
>                  break
>      return min(take_until(), key=key)

Heh, great minds think alike :-)




-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

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

Reply via email to