Let apply_along_axis work with more function return types: Issue/2582#5323
Let apply_along_axis work with more function return types: Issue/2582#5323oracal wants to merge 2 commits intonumpy:masterfrom
Conversation
There was a problem hiding this comment.
Be best to have a blank line after the function definition, and also class definition in the next test.
|
The commit messages should be expanded a bit. First, the summaries should begin with |
There was a problem hiding this comment.
I think it would be simpler to just do
if isscalar or not hasattr(res, `__len__`):
Even so, for better behavior I'd probably save the results of applying func in a list, make a array out of that, and then reshape it. One could instead maybe do asarray(res) up front .and check the dimension of that. I think that would solve the problem here and also work for functions that, say, return a set constructed from the elements of the axis and that currently fail.
|
☔ The latest upstream changes (presumably 84b11f5) made this pull request unmergeable. Please resolve the merge conflicts. |
Fixed issue #2582. If the function passed into the apply_along_axis function returned anything other than a "scalar" or "array-like object" then it would throw an exception that len method did not exist.