-
Notifications
You must be signed in to change notification settings - Fork 6
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
implement nsplit argument in Array.split_axes with default="auto" (raise if variable) #1078
Comments
@alixdamman : what do you think? |
Honestly, without an example of the resulting axes for each option, it is difficult to me to evaluate what would be the best solution. I am usually in favor of somewhat "forcing" the users to clean their code (i.e. check the labels, dimensions of arrays, ...), so, by default, my answer is option 1. But if you think that there are potentially many cases in which option 1 could not be practical, I am OK to choose the option 6. |
In that case, I'd go for option 7, which is basically option 1 with an easy way to deal with the exception when it happens. I will try to implement that. |
Implementing nsplit is not that urgent. Avoiding the silent failure is the urgent part so I extracted #1089 out of this and scaled down the priority. |
Besides, to be complete, we should implement a way to split right (rsplit boolean argument)? |
When the number of separators is not the same in all labels, labels which have more separators have their last part dropped silently and any label which becomes a duplicate because of this is dropped silently too (it seems like the last duplicate wins).
Also, when there is a label with fewer separators than expected, it raises a very weird error.
The two issues are because the zip(*sequences) idiom that we use happily ignores sequences longer than the shortest of the sequences.
The code of Axis.split is roughly like this:
Our options are :
nsplit
argument), using len(names) - 1 as default.The text was updated successfully, but these errors were encountered: