[LNT] r372826 - [LNT] Python 3 support: adapt to zip returning an iterator
Thomas Preud'homme via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 25 01:27:35 PDT 2019
Author: thopre
Date: Wed Sep 25 01:27:35 2019
New Revision: 372826
URL: http://llvm.org/viewvc/llvm-project?rev=372826&view=rev
Log:
[LNT] Python 3 support: adapt to zip returning an iterator
Summary:
zip() returns a list in Python 2 but an iterator in Python 3.
Fortunately, the only use is in the return statement in pairs() and the
only call site of pairs() iterates over the result. This commit thus
adds a docstrings for pairs to make it clear callers can only rely on
the result being iterable. It also rename the parameter to not conflict
with the list builtin function.
Reviewers: cmatthews, hubert.reinterpretcast, kristof.beyls
Reviewed By: hubert.reinterpretcast
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D67819
Modified:
lnt/trunk/lnt/server/reporting/report.py
Modified: lnt/trunk/lnt/server/reporting/report.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/reporting/report.py?rev=372826&r1=372825&r2=372826&view=diff
==============================================================================
--- lnt/trunk/lnt/server/reporting/report.py (original)
+++ lnt/trunk/lnt/server/reporting/report.py Wed Sep 25 01:27:35 2019
@@ -8,8 +8,9 @@ from collections import namedtuple
OrderAndHistory = namedtuple('OrderAndHistory', ['max_order', 'recent_orders'])
-def pairs(list):
- return zip(list[:-1], list[1:])
+def pairs(l):
+ """Make an iterable of all pairs of consecutive elements in l."""
+ return zip(l[:-1], l[1:])
# The hash color palette avoids green and red as these colours are already used
# in quite a few places to indicate "good" or "bad".
More information about the llvm-commits
mailing list