-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Add endof for Pair #12335
Add endof for Pair #12335
Conversation
Ref #12261 which broke JuMP |
@@ -441,6 +441,9 @@ getindex(p::Pair,i::Int) = getfield(p,i) | |||
getindex(p::Pair,i::Real) = getfield(p, convert(Int, i)) | |||
reverse(p::Pair) = Pair(p.second, p.first) | |||
|
|||
first(p::Pair) = p.first |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why add this definition if first(::Pair)
already works?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only for clarity
Alternatively, I think this could be implemented by adding |
@joehuchette, could you squash? |
4b6a8a8
to
71ee608
Compare
Are there any objections to this? Since you can already do |
this lgtm, ci's a bit backed up since there were a lot of merges today |
first(::Pair)
already works on master, this adds the correspondinglast
method.