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

Nathaniel Smith njs at pobox.com
Tue Mar 18 00:08:51 CET 2014


On Fri, Mar 14, 2014 at 8:15 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> A few other miscellaneous comments:
>
> - nice work on the PEP Nathaniel!

Thanks!

> - as with others, "@" as the operator doesn't thrill me, but I also think it
> crosses the threshold of "good enough given the constraints"
> - the PEP should probably recommend adding an "operator.matmul" function, a
> "PyObject_MatrixMultiply" C API and consider whether or not the new special
> method should be given a C level type slot.

operator.matmul and PyObject_MatrixMultiply are obvious enough, but
I'm afraid I'm not too clear on the tradeoffs about adding a C level
type slot, or even entirely sure what the alternative is. (I guess I
just assumed that all special methods used C level type slots and
there was nothing to think about.) Do you (or anyone) have any
thoughts?

-- 
Nathaniel J. Smith
Postdoctoral researcher - Informatics - University of Edinburgh
http://vorpus.org


More information about the Python-ideas mailing list