[Bengt Richter] > What about some semantics like my izip2 in > http://groups.google.com/group/comp.lang.python/msg/3e9eb63a1ddb1f46?hl=en > > (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. Raymond -- http://mail.python.org/mailman/listinfo/python-list