Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent behaviour of zip comprehensions #33168

Closed
AzamatB opened this issue Sep 5, 2019 · 2 comments
Closed

Inconsistent behaviour of zip comprehensions #33168

AzamatB opened this issue Sep 5, 2019 · 2 comments

Comments

@AzamatB
Copy link
Contributor

AzamatB commented Sep 5, 2019

Consider

julia> [rand() for _ in 1:3]
3-element Array{Float64,1}:
 0.084950477529397 
 0.5901110231368294
 0.5850548894960674

julia> [rand() for _ in zip(1:3, 1:5)] # expected this to work as the previous one
ERROR: DimensionMismatch("dimensions must match")
Stacktrace:
 [1] promote_shape at ./indices.jl:154 [inlined]
 [2] _promote_shape at ./iterators.jl:317 [inlined]
 [3] axes at ./iterators.jl:316 [inlined]
 [4] _array_for at ./array.jl:598 [inlined]
 [5] collect(::Base.Generator{Base.Iterators.Zip{Tuple{UnitRange{Int64},UnitRange{Int64}}},getfield(Main, Symbol("##57#58"))}) at ./array.jl:611

This failure does not make sense to me. Also if I turn the comprehension into loop it works again

for _ in zip(1:3, 1:5)
   rand()
end
@TheBB
Copy link

TheBB commented Sep 5, 2019

Presumably fixed by #29927

@mschauer
Copy link
Contributor

mschauer commented Apr 5, 2020

Fixed by #29927

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants