[Numpy-discussion] Re: The source code corresponding to numpy.invert.

2021-10-04 Thread Hongyi Zhao
On Mon, Oct 4, 2021 at 11:54 PM Stephen Waterbury wrote: > > On 10/4/21 10:07 AM, Hongyi Zhao wrote: > > On Mon, Oct 4, 2021 at 9:33 PM Robert Kern wrote: > > On Mon, Oct 4, 2021 at 5:17 AM Hongyi Zhao wrote: > > That’s just the way Python’s syntax works. Operators are not names that can > be r

[Numpy-discussion] Re: The source code corresponding to numpy.invert.

2021-10-04 Thread Stephen Waterbury
On 10/4/21 10:07 AM, Hongyi Zhao wrote: On Mon, Oct 4, 2021 at 9:33 PM Robert Kern wrote: On Mon, Oct 4, 2021 at 5:17 AM Hongyi Zhao wrote: That’s just the way Python’s syntax works. Operators are not names that can be resolved to objects that can be compared with the `is` operator. Inste

[Numpy-discussion] Re: The source code corresponding to numpy.invert.

2021-10-04 Thread Hongyi Zhao
On Mon, Oct 4, 2021 at 9:33 PM Robert Kern wrote: > > On Mon, Oct 4, 2021 at 5:17 AM Hongyi Zhao wrote: >> >> >> > That’s just the way Python’s syntax works. Operators are not names that >> > can be resolved to objects that can be compared with the `is` operator. >> > Instead, when that operato

[Numpy-discussion] Re: The source code corresponding to numpy.invert.

2021-10-04 Thread Robert Kern
On Mon, Oct 4, 2021 at 5:17 AM Hongyi Zhao wrote: > > > That’s just the way Python’s syntax works. Operators are not names that > can be resolved to objects that can be compared with the `is` operator. > Instead, when that operator is evaluated in an expression, the Python > interpreter will look

[Numpy-discussion] Re: The source code corresponding to numpy.invert.

2021-10-04 Thread Hongyi Zhao
On Mon, Oct 4, 2021 at 4:41 PM Robert Kern wrote: > > On Mon, Oct 4, 2021 at 1:09 AM wrote: >> >> Thank you for pointing this out. This is the code block which includes the >> first appearance of the keyword `logical_not`. >> >> BTW, why can't the ~ operator be tested equal to 'np.invert', as sh

[Numpy-discussion] Re: The source code corresponding to numpy.invert.

2021-10-04 Thread Robert Kern
On Mon, Oct 4, 2021 at 1:09 AM wrote: > Thank you for pointing this out. This is the code block which includes the > first appearance of the keyword `logical_not`. > > BTW, why can't the ~ operator be tested equal to 'np.invert', as shown > below: > > ``` > In [1]: import numpy as np > In [3]: np

[Numpy-discussion] Re: The source code corresponding to numpy.invert.

2021-10-03 Thread hongyi . zhao
Thank you for pointing this out. This is the code block which includes the first appearance of the keyword `logical_not`. BTW, why can't the ~ operator be tested equal to 'np.invert', as shown below: ``` In [1]: import numpy as np In [3]: np.invert is np.bitwise_not Out[3]: True In [4]: np.inv

[Numpy-discussion] Re: The source code corresponding to numpy.invert.

2021-10-03 Thread Robert Kern
On Mon, Oct 4, 2021 at 12:09 AM wrote: > > (the bool implementation uses the `logical_not` loop). > > Do you the following code snippet: > > > https://github.com/numpy/numpy/blob/3c1e9b4717b2eb33a2bf2d495006bc300f5b8765/numpy/core/src/umath/loops.c.src#L1627-L1633 This is the one that gets exp

[Numpy-discussion] Re: The source code corresponding to numpy.invert.

2021-10-03 Thread hongyi . zhao
> (the bool implementation uses the `logical_not` loop). Do you the following code snippet: https://github.com/numpy/numpy/blob/3c1e9b4717b2eb33a2bf2d495006bc300f5b8765/numpy/core/src/umath/loops.c.src#L1627-L1633 ___ NumPy-Discussion mailing list -- nu

[Numpy-discussion] Re: The source code corresponding to numpy.invert.

2021-10-03 Thread Robert Kern
On Sun, Oct 3, 2021 at 9:27 PM wrote: > > So, C/Python operator `~` has been overridden by the corresponding user > function in numpy, but where is the corresponding source code > implementation? > ufuncs are implemented in C. We provide so-called loop functions that iterate over contiguous segm