aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Preud'homme <thomasp@graphcore.ai>2019-09-25 08:27:35 +0000
committerThomas Preud'homme <thomasp@graphcore.ai>2019-09-25 08:27:35 +0000
commit0579bd43010177c3f29c027a7e00491304a27e89 (patch)
tree4813809b173ce4408d97796143a8294cc4aea237
parentd2d9a74a0436631ab3c87c46e5746b61c6dedad7 (diff)
[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 git-svn-id: https://llvm.org/svn/llvm-project/lnt/trunk@372826 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lnt/server/reporting/report.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/lnt/server/reporting/report.py b/lnt/server/reporting/report.py
index 50e08eb..e2c657f 100644
--- a/lnt/server/reporting/report.py
+++ b/lnt/server/reporting/report.py
@@ -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".