Why is Python zip length not as expected?

Nice addition, @richaaroy! If I can chime in, there’s another angle here—compatibility with Python 2.x. In that case, you’d use itertools.izip instead of zip. It’s optimized for memory efficiency because it doesn’t immediately consume memory by creating a list.

import itertools  
zipall = itertools.izip(x1, x2, x3)  
for item in zipall:  
    print(item)  

It behaves similarly to zip, but is particularly useful for larger datasets in Python 2. And of course, you can convert it to a list if you need to do length calculations, just like Tom suggested earlier.