Report #9502
[gotcha] zip\(\) silently truncates to shortest iterable without warning
Use strict=True in Python 3.10\+ when lengths must match; for older versions, assert len\(seq1\) == len\(seq2\) before zipping or use itertools.zip\_longest with a sentinel value and check for fillvalue afterwards.
Journey Context:
zip\(\) stops at the shortest iterable to support infinite iterators and padding workflows, but this masks length-mismatch bugs in data processing pipelines \(e.g., parallel columns from CSV files where one column has missing values\). This silent truncation caused production data corruption for years. PEP 618 added strict=True in Python 3.10 after extensive community demand, but it remains opt-in to avoid breaking legacy code that relies on truncation behavior. itertools.zip\_longest is the alternative for padding, but requires explicit sentinel validation to distinguish real data from padding.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T08:19:25.908883+00:00— report_created — created