Conversation
|
Not sure if the CI is failing because of changes I made |
|
@guilhermeleobas I think it was just a glitch, I restarted the travis tests for you just now. |
stuartarchibald
left a comment
There was a problem hiding this comment.
Thanks for the patch. Generally looks good but seems like a few more things are accepted by this function (see comments). Also, the documentation will need an update in this section: https://github.com/numba/numba/blob/37ab1420fa87d02b635991b32f0faf5c65e8fc4d/docs/source/reference/numpysupported.rst#other-functions
Thanks.
numba/targets/arraymath.py
Outdated
| @overload(np.alen) | ||
| def np_alen(a): | ||
| if not type_can_asarray(a): | ||
| raise errors.TypingError("The argument to np.shape must be array-like") |
There was a problem hiding this comment.
The function being typed is np.alen not np.shape?
There was a problem hiding this comment.
Also, np.alen seems to accept a very broad range of things...
In [12]: np.alen('aaa')
Out[12]: 3
In [13]: np.alen(np)
Out[13]: 1
In [14]: np.alen(np.alen)
Out[14]: 1
some of which are very strange, I don't think the bizarre things are worth considering, however, strings and perhaps other types in numba's type system that can be accepted should be.
There was a problem hiding this comment.
I've implemented alen for strings.
|
Just out of curiosity, are there situations where you have seen |
|
Actually, on further investigation, I don't see this method in the NumPy docs at all. Was this dropped from NumPy at some point? |
|
It's still in numpy: https://github.com/numpy/numpy/blob/master/numpy/core/fromnumeric.py#L2758 |
|
I don't think |
|
As I know it was introduced when |
A quick search on GitHub shows that some people still use |
|
Seems like it's now scheduled for deprecation over in NumPy numpy/numpy#14155 (comment), I think that this is probably the best outcome for everyone and suggest that we don't replicate a feature scheduled for deprecation. Are you ok with this outcome @guilhermeleobas? It was great that you put up this PR, but I think the overall outcome of helping clean up NumPy by forcing a query on the use of this function is a net positive outcome too. |
|
Yes, no worries |
|
@guilhermeleobas thanks for your understanding, much appreciated. Closing. |
This PR implements
np.alen.I didn't include any test using regular lists because the usage of reflection lists is being deprecated.