Skip to content← All gravesR.I.P.
Loop that skipped the last item
–
“Almost made it to the end. Almost.”
PythonOff-by-one
Death certificate
- Status
- 🪦 Buried
- Cause of death
- Off-by-oneLooped once too often, or once too few. A `<=` where a `<` belonged.
- Severity
- Low
- Hours to kill
- 3 hours
- Killed by
- Jashanpreet
- Language
- Python
- Born
- 12 Feb 2024
- Fix merged
- 15 Feb 2024
- Buried
- 26 Feb 2024
- Component
- reports
- Symptoms
- The last row of every exported report was missing: the loop stopped one item early.
- The fix
- Looped over the whole list instead of stopping at length minus one.
Timeline
Every life of this bug, oldest first.
- 🐛
Born as “Loop that skipped the last item”12 Feb 2024
- 🩹
Fix merged15 Feb 2024
- 🪦
Buried26 Feb 2024