[Python-3000] [PythonInfo Wiki] Update of "GoogleSprintPy3k" by 22.214.171.124
Guido van Rossum
guido at python.org
Mon Aug 21 21:14:54 CEST 2006
On 8/21/06, Georg Brandl <g.brandl at gmx.net> wrote:
> > + * Make map() and filter() iterators and make them stop at the end of the shortest input (like zip()) instead of at the end of the longest input
> May I suggest an additional keyword(-only?) argument to get the old behavior,
> stopping at the end of the longest input?
I'd rather not. Why, apart from backwards compatibility?
I'd like map(f, a, b) to be the same as to (f(*x) for x in zip(a, b))
so we have to explain less. (And I think even map(f, *args) === (f(*x)
for x in zip(*args)).)
The right way to write code that works in 2.6 and 3.0 is to only use
inputs of the same length.
Perhaps there could be (or is there already?) a helper in itertools
that iterates over multiple iterables padding the shorter inputs with
None to the length of the longest one.
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-3000