Convert some uses of range(len(x)) to enumerate(x).

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
This commit is contained in:
brian m. carlson 2014-07-15 15:35:13 +00:00
parent 223ed1e3d3
commit 7395798515
No known key found for this signature in database
GPG key ID: BF535D811F52F68B

View file

@ -115,8 +115,8 @@ class Tabbable:
pass
if key in ("next-field", "previous-field"):
item = 0
for i in range(len(self.grid.cells)):
if self in self.grid.cells[i].widget_list:
for i, cell in enumerate(self.grid.cells):
if self in cell.widget_list:
item = i
break
offset = 1 if key == "next-field" else -1
@ -204,9 +204,9 @@ class RecordFormatter:
return []
res = [0] * len(x[0])
for l in x:
for i in range(len(l)):
if len(l[i]) > res[i]:
res[i] = len(l[i])
for i, li in enumerate(l):
if len(li) > res[i]:
res[i] = len(li)
return res
def format(self):