[Python-ideas] Possible PEP 380 tweak
rrr at ronadam.com
Mon Oct 25 22:08:06 CEST 2010
On 10/25/2010 02:53 PM, Ron Adam wrote:
> def reduce_collector(func):
> value = yield # No value to yield here.
> while True:
> value = func((yield), value) # or here.
> except YieldError:
> # next was called not send.
> yield = value
This line should have been "yield value" not "yield = value".
> def parallel_reduce(iterable, funcs):
> collectors = [reduce_collector(func) for func in funcs]
> for v in iterable:
> for coll in collectors:
> return [next(c) for c in collectors]
More information about the Python-ideas