summaryrefslogtreecommitdiff
path: root/numpy/lib/utils.py
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2021-09-01 16:51:41 +0300
committerGitHub <noreply@github.com>2021-09-01 16:51:41 +0300
commit68299575d8595d904aff6f28e12d21bf6428a4ba (patch)
treef59f89c4786b8298fe25ef4f082f51366b388bb3 /numpy/lib/utils.py
parent0656fc493591be2200b0b0df5e14fb547aa4702f (diff)
parent64f15a94708095bf9d29af5dbfcc4b654a57248a (diff)
downloadnumpy-68299575d8595d904aff6f28e12d21bf6428a4ba.tar.gz
Merge pull request #19781 from mwtoews/foreach-item
MAINT: refactor "for ... in range(len(" statements
Diffstat (limited to 'numpy/lib/utils.py')
-rw-r--r--numpy/lib/utils.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/numpy/lib/utils.py b/numpy/lib/utils.py
index b1a916d4a..1f2cb66fa 100644
--- a/numpy/lib/utils.py
+++ b/numpy/lib/utils.py
@@ -351,8 +351,7 @@ def who(vardict=None):
maxshape = 0
maxbyte = 0
totalbytes = 0
- for k in range(len(sta)):
- val = sta[k]
+ for val in sta:
if maxname < len(val[0]):
maxname = len(val[0])
if maxshape < len(val[1]):
@@ -369,8 +368,7 @@ def who(vardict=None):
prval = "Name %s Shape %s Bytes %s Type" % (sp1*' ', sp2*' ', sp3*' ')
print(prval + "\n" + "="*(len(prval)+5) + "\n")
- for k in range(len(sta)):
- val = sta[k]
+ for val in sta:
print("%s %s %s %s %s %s %s" % (val[0], ' '*(sp1-len(val[0])+4),
val[1], ' '*(sp2-len(val[1])+5),
val[2], ' '*(sp3-len(val[2])+5),