Skip to content

Wrapping ak.Array #1177

Answered by jpivarski
fleble asked this question in Q&A
Dec 7, 2021 · 3 comments · 7 replies
Discussion options

You must be logged in to vote

Thanks, @agoose77, for answering this! You made all the points I wanted to except the "why".

You can make subclasses of ak.Array and ak.Record, but you have to assign them through ak.behavior. There's a big write-up of that here:

https://awkward-array.readthedocs.io/en/latest/ak.behavior.html

When you do array manipulations, you end up creating new array objects all the time—every slice is a new array object from Python's point of view (though the data buffers themselves share a lot of memory for efficiency). The ak.behavior is a set of rules for applying your subclasses to new array objects depending on "parameters" in the array, so even if your data type is buried deeply in a data struc…

Replies: 3 comments 7 replies

Comment options

You must be logged in to vote
6 replies
@agoose77
Comment options

@grst
Comment options

@agoose77
Comment options

@grst
Comment options

@jpivarski
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by fleble
Comment options

You must be logged in to vote
1 reply
@agoose77
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants