Message300790
| Author |
rami |
| Recipients |
docs@python, rami |
| Date |
2017年08月24日.16:30:23 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1503592223.48.0.262016465806.issue31270@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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 |
|
History
|
|---|
| 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 |
|