[PATCH] D67817: [LNT] Python 3 support: adapt to map returning a view

Hubert Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 23 07:28:11 PDT 2019


hubert.reinterpretcast added inline comments.


================
Comment at: lnt/external/stats/stats.py:1568-1571
+    tmp = list(map(N.array, lists))
+    means = list(map(amean, tmp))
+    vars = list(map(avar, tmp))
+    ns = list(map(len, lists))
----------------
thopre wrote:
> These do not seem to be used later in the function, how can I check if these are global variables?
>From https://docs.python.org/3/faq/programming.html#what-are-the-rules-for-local-and-global-variables-in-python:
> If a variable is assigned a value anywhere within the function’s body, it’s assumed to be a local unless explicitly declared as global.


================
Comment at: lnt/external/stats/stats.py:1569
     alldata = []
-    tmp = map(N.array,lists)
-    means = map(amean,tmp)
-    vars = map(avar,tmp)
-    ns = map(len,lists)
+    tmp = map(N.array, lists)
+    means = list(map(amean, tmp))
----------------
`tmp` is consumed twice immediately below, so the `list` application would still be appropriate if we aren't removing this block altogether.


================
Comment at: lnt/external/stats/stats.py:1575
         alldata = alldata + lists[i]
     alldata = N.array(alldata)
     bign = len(alldata)
----------------
Drive by:
`alldata = N.array(list(itertools.chain.from_iterable(lists)))`


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67817/new/

https://reviews.llvm.org/D67817





More information about the llvm-commits mailing list