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

zip() returns scalar instead of tuple when passed a single argument in 0.4 #13979

Closed
nalimilan opened this issue Nov 13, 2015 · 1 comment
Closed
Labels
regression Regression in behavior compared to a previous version

Comments

@nalimilan
Copy link
Member

Is this intended or a regression?

In 0.3:

julia> i = zip(1:2)
Zip{(UnitRange{Int64},)}((1:2,))

julia> start(i)
(1,)

julia> next(i, (1,))
((1,),(2,))

In 0.4:

julia> i = zip(1:2)
2-element UnitRange{Int64}:
 1,2

julia> start(i)
1

julia> next(i, 1)
(1,2)

This means you cannot handle single-argument and multiple-argument cases with the same code. I encountered this issue when doing something similar to:

function (x...) 
...
    vtypes = map(eltype, typeof(x).parameters)
    d = Dict{Tuple{vtypes...}, Any}()
    for el in zip(x...)
        # Error in convert()
        d[el] = true
    end
...
end
@nalimilan nalimilan added the regression Regression in behavior compared to a previous version label Nov 13, 2015
@nalimilan
Copy link
Member Author

A line zip(a) = a was introduced by @JeffBezanson in eaf5a95. Since there is no mention of this particular change, this looks like an oversight to me. That line also isn't exercised by the tests at all.

See PR #13990

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression Regression in behavior compared to a previous version
Projects
None yet
Development

No branches or pull requests

1 participant