How to properly and stylishly write code with a new matrix multiplication operator ? And why?

A@ B ?

A@B ?

A @ B ?

The PEP465 uses the third recording option, but for me it is too long. And unusual. And the second is short. And the first is completely incomprehensible. The numpy documentation, for example, does not use the symbol at all, replacing everything with A.matmul(B) . Strange general operator. Why is PEP8 silent on this?

    1 answer 1

    PEP8 is not silent about this:

    If you’re using the lowest priorities (ies). Use your own judgment; however, it is always the same amount of the binary operator.

    Based on this, the first option is invalid, the second can be used if operators with lower priority are used in the expression, and the third is used in all other cases.

    • True, but I expected an explicit indication. - m9_psy