Do you have real-world use cases for map's None fill-in feature?

Raymond Hettinger python at
Tue Jan 10 09:47:36 CET 2006

[Bengt Richter]
> What about some semantics like my izip2 in
> (which doesn't even need a separate name, since it would be backwards compatible)
> Also, what about factoring sequence-related stuff into being methods or attributes
> of iter instances? And letting iter take multiple sequences or callable/sentinel pairs,
> which could be a substitute for izip and then some? Methods could be called via a returned
> iterator before or after the first .next() call, to control various features, such as
> sentinel testing by 'is' instead of '==' for callable/sentinel pairs, or buffering n
> steps of lookahead supported by a .peek(n) method defaulting to .peek(1), etc. etc.
> The point being to have a place to implement universal sequence stuff.

ISTM, these cures are worse than the disease ;-)

> Even if there is little use for continuing in correct code, IWT getting
> at the state of the iterator in an erroroneous situation would be a benefit.
> Being able to see the result of the last attempt at gathering tuple elements
> could help. (I can see reasons for wanting variations of trying all streams
> vs shortcutting on the first to exhaust though).

On the one hand, that seems reasonable.  On the other hand, I can't see
how to use it without snarling the surrounding code in which case it is
probably better to explicitly manage individual iterators within a
while loop.


More information about the Python-list mailing list