On Mon, Oct 4, 2021 at 11:54 PM Stephen Waterbury
<water...@pangalactic.us> wrote:
>
> On 10/4/21 10:07 AM, Hongyi Zhao wrote:
>
> On Mon, Oct 4, 2021 at 9:33 PM Robert Kern <robert.k...@gmail.com> wrote:
>
> On Mon, Oct 4, 2021 at 5:17 AM Hongyi Zhao <hongyi.z...@gmail.com> 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 up a specially-named method on the operand object (in this case 
> `__invert__`). Numpy array objects implement this method using `np.invert`.
>
> If so, which is symlink to which, I mean, which is the original name,
> and which is an alias?
>
> "symlink" and "alias" are probably not the best analogies. The implementation 
> of `np.ndarry.__invert__` simply calls `np.invert` to do the actual 
> computation.
>
> It seems that the above calling/invoking logic/mechanism is not so
> clear or easy to understand/figure out only by reading the document,
> say, by the following commands in IPython:
>
> import numpy as np
> help(np.invert)
> np.invert?
> np.info(np.invert)
>
> You probably want to read the Python Language Reference regarding "Special 
> Methods":
>
> https://docs.python.org/3.9/reference/datamodel.html#special-method-names

Thank you for directing me to this helpful documentation.

HZ
_______________________________________________
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

Reply via email to