You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems inconsistent that collect(zip(1:3, 1:10)) throws a DimensionMismatch error:
julia>collect(zip(1:3, 1:10))
ERROR:DimensionMismatch("dimensions must match: a has dims (Base.OneTo(3),), b has dims (Base.OneTo(10),), mismatch at 1")
Stacktrace:
[1] promote_shape at ./indices.jl:178 [inlined]
[2] _promote_shape at ./iterators.jl:318 [inlined]
[3] axes at ./iterators.jl:317 [inlined]
[4] _similar_for at ./array.jl:578 [inlined]
[5] _collect(::UnitRange{Int64}, ::Base.Iterators.Zip{Tuple{UnitRange{Int64},UnitRange{Int64}}}, ::Base.HasEltype, ::Base.HasShape{1}) at ./array.jl:609
[6] collect(::Base.Iterators.Zip{Tuple{UnitRange{Int64},UnitRange{Int64}}}) at ./array.jl:603
[7] top-level scope at REPL[2]:1
but
for (i,j) in zip(1:3, 1:10)
...
end
runs fine. Also the docs for zip say that it will just stop when the first iterator runs out, not that it will error if the iterators have different lengths.
In general I think we should allow zip to accept iterators of different length and be consistent with this.
The text was updated successfully, but these errors were encountered:
This is indeed a bug. It looks like axes is wrongly implemented for zip.
IteratorSize returns HasShape{1}(), but the documentation for IteratorSize states that anything has returns a HasShape should have axes defined for it. axes(::Zip) uses promote_shape, which does not reflect the actual size of a zip object.
It seems inconsistent that
collect(zip(1:3, 1:10))
throws aDimensionMismatch
error:but
runs fine. Also the docs for
zip
say that it will just stop when the first iterator runs out, not that it will error if the iterators have different lengths.In general I think we should allow
zip
to accept iterators of different length and be consistent with this.The text was updated successfully, but these errors were encountered: