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
{{ message }}
Repository navigation
All the getindex implementations should use view, not slice #26
Oh, but maybe this means that the AwkwardArray getindex is correct because it copies, and I should additionally provide a view override.
(In Python, Content instances are considered immutable, so they view everywhere. But AwkwardArray.jl implements Base.push! and Base.append! on its Content instances, so perhaps they should not be presumed immutable. It's also less necessary to require immutability, since typical usage in Julia will be to iterate over arrays, rather than call functions that replace arrays with new arrays.)
Activity
Moelf commentedon Aug 31, 2023
hmm, I'm pretty sure you're not supposed to make a default slice "view"
JuliaLang/julia#47078
jpivarski commentedon Aug 31, 2023
This is what I'm seeing, with the concrete
Vectorclass, at least:Oh, but maybe this means that the AwkwardArray
getindexis correct because it copies, and I should additionally provide aviewoverride.(In Python,
Contentinstances are considered immutable, so they view everywhere. But AwkwardArray.jl implementsBase.push!andBase.append!on itsContentinstances, so perhaps they should not be presumed immutable. It's also less necessary to require immutability, since typical usage in Julia will be to iterate over arrays, rather than call functions that replace arrays with new arrays.)Moelf commentedon Aug 31, 2023
you don't need to add view override yourself. All
AbstractArraywhich hasgetindex()correctly implemented hasview()by default.You can use
@viewon one expression, or@viewson a whole lexical code block to recover Numpy default slicing