Regarding adding new function in Numpy

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Regarding adding new function in Numpy

ANURAG ANURAG
Sir, 
I was recently converting some Matlab codes into python, where I recently stumble upon bitget(n,x) function of Matlab,  b = bitget(A,bit) returns the bit value at the position bit in integer array A. I was unable to find any Numpy equivalent of this, so should I create a pull request in Numpy for the same! 

Regards,
Anurag
  




_______________________________________________
NumPy-Discussion mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/numpy-discussion
Reply | Threaded
Open this post in threaded view
|

Re: Regarding adding new function in Numpy

Matthew Brett
Hi,

On Sun, Jul 7, 2019 at 11:41 PM ANURAG ANURAG <[hidden email]> wrote:
>
> Sir,
> I was recently converting some Matlab codes into python, where I recently stumble upon bitget(n,x) function of Matlab,  b = bitget(A,bit) returns the bit value at the position bit in integer array A. I was unable to find any Numpy equivalent of this, so should I create a pull request in Numpy for the same!

Thanks for the suggestion.  I think Eric Wieser is right in his
comment on the related pull request:

https://github.com/numpy/numpy/pull/13937#issuecomment-509091992

The function is a one-liner in Python - albeit a slightly fancy
one-liner.  Also - I have never had need of this function in Matlab or
Numpy, and had no idea it existed.   So, I'd vote against, unless it
turned out it was much more common in use than my experience would
suggest,

Cheers,

Matthew
_______________________________________________
NumPy-Discussion mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/numpy-discussion