[Python-ideas] [RFC] draft PEP: Dedicated infix operators for matrix multiplication and matrix power

Devin Jeanpierre jeanpierreda at gmail.com
Mon Mar 24 04:48:49 CET 2014


On Sun, Mar 23, 2014 at 8:12 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> I think it is highly unlikely that people will be frightened off from
> overloading @ by the name. If people happily use __lt__ for subset
> checking, which is *nothing* like less-than,

Actually, no. <, or "less than", is the exact way it's spelled for any
partial order, and subset relations are probably the most famous
non-numeric example of a partial order.

In fact, if you look at the most common construction of the natural
numbers (0 = frozenset(), succ(x) = frozenset(x) | x), it is more
complicated than it needs to be only so that the < operator means the
same thing for natural numbers when treated as numbers or as sets.

>> It'd be like if we had "__twos_complement_bitwise_and__".
>
> Having __matmul__ would be like if we had  __xor__ __pow__
> __sub__ __div__ __mod__ __pos__ or __neg__

Then we disagree.

-- Devin


More information about the Python-ideas mailing list