
Feb. 12, 2010
5:54 p.m.
2010/2/12 Andrey Fedorov <anfedorov@gmail.com>:
Is that right, or am I missing something obvious?
The semantics are non-obvious, for one. I assume you mean that the following lines would be equivalent: starreduce(f, iterable, initial) reduce(lambda x,y: f(x, *y), iterable, initial) This is useful for the types of reduction where the result of the function is one type, and the iterable is a sequence of args to that function. For example: reduce(lambda x,y: str.replace(x, *y), (('a', 'aa'), ('b', 'bb',)), some_string) could be written as starreduce(str.replace, (('a', 'aa'), ('b', 'bb',)), some_string) It seems like a very narrow use-case, unless you mean something else. Vitor