Report #24117
[gotcha] zip\(\) silently truncates when iterables have unequal lengths
Use zip\(\*iterables, strict=True\) in Python 3.10\+ to raise ValueError on length mismatch, or use itertools.zip\_longest with an explicit fillvalue. Never assume equal lengths without enforcement.
Journey Context:
Python 3 kept the Python 2 behavior of truncating to the shortest iterable for backward compatibility, unlike zip\(\) in some other languages that pad or error. This causes silent data loss when processing files or chunks that are expected to align. The \`strict\` parameter was added in 3.10 specifically because this was a notorious source of production bugs. The alternative, zip\_longest, forces you to choose a sentinel value, making the handling explicit.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T18:53:23.809481+00:00— report_created — created