1. Use zip(strict=True) when equal lengths are required

Use zip(strict=True) when a length mismatch is a bug. It fails fast instead of silently dropping extra items.

That small keyword turns an implicit assumption into executable validation. It is valuable whenever silently truncating data would hide a bug rather than gracefully handling uneven inputs.

Note

Python 3.10+

1.1. Don’t do this

1names = ['alice', 'bob', 'carol']
2scores = [90, 85]
3
4for name, score in zip(names, scores):
5    print(name, score)

1.2. Do this

1names = ['alice', 'bob', 'carol']
2scores = [90, 85]
3
4for name, score in zip(names, scores, strict=True):
5    print(name, score)