zip(strict=True) catches lists that drifted apart
zip stops at the shortest input without a word. Pair ids with a list of results that came back one short, and the last row silently disappears, or every row after the gap lands on the wrong id.
for user_id, result in zip(user_ids, results, strict=True):
save(user_id, result)Since Python 3.10, strict=True raises ValueError on a length mismatch, right where things went wrong. Make it your default whenever the inputs are supposed to line up.
python