[Python-ideas] [RFC] draft PEP: Dedicated infix operators for matrix multiplication and matrix power
Antoine Pitrou
solipsis at pitrou.net
Fri Mar 14 11:29:31 CET 2014
On Fri, 14 Mar 2014 11:16:34 +0100
"M.-A. Lemburg" <mal at egenix.com> wrote:
>
> 4. Another very common operation needed in vector/matrix calculation
> is transposition. This is usually written as superscript "T" or "t"
> ("ᵀ" in Unicode). Wouldn't this operator be needed as well, to
> make the picture complete ? OTOH, we currently don't have postfix
> operators in Python, so I guess writing this as A.transpose()
> comes close enough ;-)
Or simply implement __invert__, so you can write it "~ A".
(__invert__ doesn't really invert a number, it takes the bitwise
complement :-))
> Hmm, even though I'd love to see matrix operators in Python,
> I don't think they really add clarity to the syntax of matrix
> calculations - a bit disappointing, I must say :-(
I think they do when you have several of these operations combined in a
single formula, with parentheses and the like.
Regards
Antoine.
More information about the Python-ideas
mailing list