Skip to content

Flattening without having to worry about current depth #585

Answered by jpivarski
Superharz asked this question in Q&A
Discussion options

You must be logged in to vote

I couldn't exactly reproduce this, even going back to 0.4.5. If you pass axis=0 to ak.flatten, the case is handled in Python code and you don't get this error message that comes from C++. Tinkering with it, I did find an unhandled corner-case: if you pass the negative axis that is equivalent to axis=0 (such as axis=-2 for a singly jagged array or axis=-1 for a flat array), it missed the check for axis == 0 and went into C++. As far as I can see, that's the only way to encounter this error message.

(The C++ code was written under the assumption that axis == 0 would never be allowed, but it made sense to add that case, though its behavior is entirely different from any other axis value. Since

Replies: 2 comments 1 reply

Comment options

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

Answer selected by Superharz
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #585 on December 09, 2020 17:22.