<p dir="auto">Like Python, Julia's <code class="notranslate">zip(a, b)</code> ignores the tail end of its input sequences when they are of unequal length (but see <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="170274627" data-permission-text="Title is private" data-url="https://github.com/JuliaLang/julia/issues/17928" data-hovercard-type="issue" data-hovercard-url="/JuliaLang/julia/issues/17928/hovercard" href="https://github.com/JuliaLang/julia/issues/17928">#17928</a>). I've yet to encounter a problem where I wanted that behavior, and I would much prefer seeing an error when the inputs are of unequal length. Are there applications where truncation is very convenient?</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="julia&gt; collect(zip([1,2,3],[1,2],[1,2,3]))
ERROR: DimensionMismatch(&quot;dimensions must match&quot;)
 in promote_shape(::Tuple{Base.OneTo{Int64}}, ::Tuple{Base.OneTo{Int64}}) at ./operators.jl:401
 in indices(::Base.Zip2{Array{Int64,1},Array{Int64,1}}) at ./iterator.jl:91
 in _similar_for(::UnitRange{Int64}, ::Type{T}, ::Zip{Array{Int64,1},Base.Zip2{Array{Int64,1},Array{Int64,1}}}, ::Base.HasShape) at ./array.jl:260
 in collect(::Zip{Array{Int64,1},Base.Zip2{Array{Int64,1},Array{Int64,1}}}) at ./array.jl:270

julia&gt; for x in zip([1,2,3],[1,2],[1,2,3])
       println(x)
       end
(1,1,1)
(2,2,2)"><pre class="notranslate">julia<span class="pl-k">&gt;</span> <span class="pl-c1">collect</span>(<span class="pl-c1">zip</span>([<span class="pl-c1">1</span>,<span class="pl-c1">2</span>,<span class="pl-c1">3</span>],[<span class="pl-c1">1</span>,<span class="pl-c1">2</span>],[<span class="pl-c1">1</span>,<span class="pl-c1">2</span>,<span class="pl-c1">3</span>]))
ERROR<span class="pl-k">:</span> <span class="pl-c1">DimensionMismatch</span>(<span class="pl-s"><span class="pl-pds">"</span>dimensions must match<span class="pl-pds">"</span></span>)
 <span class="pl-k">in</span> <span class="pl-c1">promote_shape</span>(<span class="pl-k">::</span><span class="pl-c1">Tuple{Base.OneTo{Int64}}</span>, <span class="pl-k">::</span><span class="pl-c1">Tuple{Base.OneTo{Int64}}</span>) at <span class="pl-k">./</span>operators<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">401</span>
 <span class="pl-k">in</span> <span class="pl-c1">indices</span>(<span class="pl-k">::</span><span class="pl-c1">Base.Zip2{Array{Int64,1},Array{Int64,1}}</span>) at <span class="pl-k">./</span>iterator<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">91</span>
 <span class="pl-k">in</span> <span class="pl-c1">_similar_for</span>(<span class="pl-k">::</span><span class="pl-c1">UnitRange{Int64}</span>, <span class="pl-k">::</span><span class="pl-c1">Type{T}</span>, <span class="pl-k">::</span><span class="pl-c1">Zip{Array{Int64,1},Base.Zip2{Array{Int64,1},Array{Int64,1}}}</span>, <span class="pl-k">::</span><span class="pl-c1">Base.HasShape</span>) at <span class="pl-k">./</span>array<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">260</span>
 <span class="pl-k">in</span> <span class="pl-c1">collect</span>(<span class="pl-k">::</span><span class="pl-c1">Zip{Array{Int64,1},Base.Zip2{Array{Int64,1},Array{Int64,1}}}</span>) at <span class="pl-k">./</span>array<span class="pl-k">.</span>jl<span class="pl-k">:</span><span class="pl-c1">270</span>

julia<span class="pl-k">&gt;</span> <span class="pl-k">for</span> x <span class="pl-k">in</span> <span class="pl-c1">zip</span>([<span class="pl-c1">1</span>,<span class="pl-c1">2</span>,<span class="pl-c1">3</span>],[<span class="pl-c1">1</span>,<span class="pl-c1">2</span>],[<span class="pl-c1">1</span>,<span class="pl-c1">2</span>,<span class="pl-c1">3</span>])
       <span class="pl-c1">println</span>(x)
       <span class="pl-k">end</span>
(<span class="pl-c1">1</span>,<span class="pl-c1">1</span>,<span class="pl-c1">1</span>)
(<span class="pl-c1">2</span>,<span class="pl-c1">2</span>,<span class="pl-c1">2</span>)</pre></div>