On Fri, Nov 25, 2022 at 9:55 PM Serge Guelton <sergesanspai...@free.fr> wrote:
> On Fri, Nov 25, 2022 at 08:09:02PM +0100, Sebastian Berg wrote: > > Thanks for bringing this up again. The Python method exists and it > > seems like relatively basic functionality. > > > > Overall, I am slightly in favor of adding the ufunc. So if nobody > > voices an opinion that it doesn't seem a good fit for NumPy, I would be > > happy to move forward with it. > It seems like there is enough demand, so +0.5 from me. > > PS: One of my main concern would be if we were to add many bitwise > > functions, in which case a `bitwise` namespace might be nice. But I am > > not convinced that should stop us here. > > Technically speaking, bitwise_and, birwise_or, bitwise_xor and bitwise_not > already exist and popcount is widely spread, it already has its compiler > builtin > under the name of __builtin_popcount > Those four `bitwise_*` functions also came to mind for me. I'll also add that Python has six bit-wise operators ( https://wiki.python.org/moin/BitwiseOperators), and because of that the array API standard implements `bitwise_left_shift` and `bitwise_right_shift` in addition to the four functions that NumPy has. So it looks to me like this new ufunc should be called `bitwise_count` rather than `bit_count`. Cheers, Ralf
_______________________________________________ NumPy-Discussion mailing list -- numpy-discussion@python.org To unsubscribe send an email to numpy-discussion-le...@python.org https://mail.python.org/mailman3/lists/numpy-discussion.python.org/ Member address: arch...@mail-archive.com