-
Notifications
You must be signed in to change notification settings - Fork 89
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
Fix: support nested option types in ak.is_none
#1249
Conversation
NB - I haven't enabled any tests that currently skip due to missing |
Codecov Report
|
1c4678f
to
dc458a4
Compare
Temporary UnionArrays are fine; they're used in a few other cases. One transformation/action invoking another is also precedented. In fact, if we know that it can go exactly two levels of transforming deep, then I think it's more readable this way than trying to feed it into itself with a different parameter, just because having different states in a finite state machine be laid out as different code on the screen is easier on human brains. "Action 1: locate, action 2: transform" is very clear.
Early return is fine. I tend to not use it because of FP influences, but avoiding stuff like this: is worthwhile, I agree. On the other hand, for something like this: I'd invert the predicate and only explicitly return the non-trivial case: if depth_context["posaxis"] == depth - 1:
return layout.recursively_apply(getfunction_inner) As you noticed, information for the next level is passed through
Okay! Let me know when that changes and I'll review it. |
The broken test is caused by #1260, I believe |
for more information, see https://pre-commit.ci
d2ce45c
to
8814309
Compare
@jpivarski I think this is also good to merge! |
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.
Indeed! Looks great!
Fixes #1193
Requires #1279
To implement this feature, I introduce a temporary union. Let me know if there's a more elegant way to do this! Given that, unlike most other layout transformers, we need to modify several layers, I've split the transformation process into two different transforms - one to locate the first layout, another to actually perform the transformation.
I also wondered whether it would be possible to write the new recursive
getfunction
s with an early-return style instead of explicitly handling each case? In the past, the return value had a lot of interpretation modes, so it was more dangerous. With v2, I wonder if we could re-consider this position?