-
Notifications
You must be signed in to change notification settings - Fork 367
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 resize!, keepat!, pop!, popfist!, popat! #3047
Conversation
@nalimilan - this PR is ready for review. Thank you! |
Co-authored-by: Milan Bouchet-Valat <nalimilan@club.fr>
…mes.jl into bk/add_resize!
throw(ArgumentError("invalid index of type Bool")) | ||
end | ||
|
||
if !(eltype(inds) <: Integer || all(x -> x isa Integer, inds)) |
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.
Same here?
if !(eltype(inds) <: Integer || all(x -> x isa Integer, inds)) | |
# this is required because of https://github.com/JuliaData/InvertedIndices.jl/issues/31 | |
if !(eltype(inds) <: Integer || all(x -> x isa Integer, inds)) |
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.
No, here it is "just required". Here we know that inds
is AbstractVector
so it is not connected with Not
. We just need to make sure all elements are Integer
, as otherwise in line 826 in general user could get a weird error that <=
is not defined for values passed.
I know it adds some performance overhead, but this method anyway is not type stable, so I think it is OK to add this check.
Co-authored-by: Milan Bouchet-Valat <nalimilan@club.fr>
Thank you! |
Partially implement changes requested in #2936.
@nalimilan - if you agree with the proposed changes (especially
deleteat!
- I think, given that the operation is expensive anyway, we can afford sorting and de-duplicating incorrect input instead of having an undefined behavior in this case) I will add tests.