On Wed, Jun 26, 2019 at 10:24 PM Marten van Kerkwijk <
m.h.vankerkw...@gmail.com> wrote:

>
> The main motivation for the @ PEP was actually to be able to get rid of
>> objects like np.matrix and scipy.sparse matrices that redefine the meaning
>> of the * operator. Quote: "This PEP proposes the minimum effective change
>> to Python syntax that will allow us to drain this swamp [meaning np.matrix
>> & co]."
>>
>> Notably, the @ PEP was written by Nathaniel, who was opposed to a copying
>> .H.
>>
>
> I should note that my comment invoking the history of @ was about the
> regular transpose, .mT.  The executive summary of the PEP includes the
> following relevant sentence:
> """
> Currently, most numerical Python code uses * for elementwise
> multiplication, and function/method syntax for matrix multiplication;
> however, this leads to ugly and unreadable code in common circumstances.
> """
>
> Exactly the same holds for matrix transpose, and indeed for many matrix
> expressions the gain in readability is lost without a clean option to do
> the transpose.
>

Yes, but that's not at all equivalent. The point for @ was that you cannot
just create your own operator in Python. Therefore there really is no
alternative to a builtin operator. For methods however, there's nothing
stopping you from building a well-designed matrix class. You can then add
all the new properties that you want.

Ralf
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion

Reply via email to