retires: use range(1, retries)

Bug #1742249 reported by Joshua Powers on 2018-01-09
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
usd-importer
Low
Nish Aravamudan

Bug Description

Trying to debug code that is in a retry loop is not straightforward as it is. Having to see variables constantly add 1 to them, because range starts at 0 rather than 1 is unclear. Can I suggest replacing code like the following from build.py:

for i in range(retries+1):
...
"(attempt %d/%d)", i+1, retries+1,
...
if i < retries:

with the following:

for i in range(1, retries):
...
"(attempt %d/%d)", i, retries,
...
if i <= retries:

Nish Aravamudan (nacc) on 2018-01-09
Changed in usd-importer:
status: New → Confirmed
assignee: nobody → Nish Aravamudan (nacc)
milestone: none → future
importance: Undecided → Low
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers