On Sat, Nov 22, 2014 at 3:37 AM, Donald Stufft <[email protected]> wrote:
> I don’t have an opinion on whether it’s enough of a big deal to actually
> change
> it, but I do find wrapping it with a try: except block and returning easier
> to understand. If you showed me the current code unless I really thought about
> it I wouldn't think about the fact that the next() calls can cause the
> generator to terminate.
And don't forget, by the way, that you can always request the current
behaviour by explicitly wrapping the body of the function in
try/except:
def izip(iterable1, iterable2):
try:
it1 = iter(iterable1)
it2 = iter(iterable2)
while True:
v1 = next(it1)
v2 = next(it2)
yield v1, v2
except StopIteration:
pass
That's exactly what current behaviour does, and if you think that that
try block is too broad and should be narrowed, then you should support
this proposal :)
ChrisA
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com