Message300790
I just noticed that in my post I accidentally pasted MY implementation twice instead of the old one, sorry for that. Here's the old one for quick comparison:
class ZipExhausted(Exception):
pass
def zip_longest(*args, **kwds):
# zip_longest('ABCD', 'xy', fillvalue='-') --> Ax By C- D-
fillvalue = kwds.get('fillvalue')
counter = len(args) - 1
def sentinel():
nonlocal counter
if not counter:
raise ZipExhausted
counter -= 1
yield fillvalue
fillers = repeat(fillvalue)
iterators = [chain(it, sentinel(), fillers) for it in args]
try:
while iterators:
yield tuple(map(next, iterators))
except ZipExhausted:
pass |
|
Date |
User |
Action |
Args |
2017-08-24 16:30:23 | rami | set | recipients:
+ rami, docs@python |
2017-08-24 16:30:23 | rami | set | messageid: <1503592223.48.0.262016465806.issue31270@psf.upfronthosting.co.za> |
2017-08-24 16:30:23 | rami | link | issue31270 messages |
2017-08-24 16:30:23 | rami | create | |
|