[Python-Dev] Re: [Fwd: Discussion: Introducing new operators formatrix computation]

Eric S. Raymond esr@thyrsus.com
Fri, 14 Jul 2000 13:36:20 -0400

Huaiyu Zhu <huaiyu_zhu@yahoo.com>:
> This is not a call for a special language for matrix only.  But we do need
> enough binary operators to override with.  The additional operators might be
> useful at other places as well.
> In matlab the following operations are all different from each other
> a+b        a.+b  
> a-b        a.-b
> a*b        a.*b
> a/b        a./b
> a\b        a.\b
> a^b        a.^b
> What python operators can we override for them all? Just one additional
> symbol for so many new binary operators is a good bargain, IMO.

Put this way, I'm more inclined to support it.  I might even be tempted
to add .| and .& for lattice algebras.  

I agree that supporting user-defined syntax threatens to fragment the language.
To avoid that, perhaps it would be best to leave what are in effect 
user-definable hooks in Python's lexical space.

This could address Greg's desire for an infix max and min as well.

The design question becomes: what undefined binary tokens do we
want to add the the language core?  With what precedence?  What is
the compiler to assume about associativity?
		<a href="http://www.tuxedo.org/~esr">Eric S. Raymond</a>

Ideology, politics and journalism, which luxuriate in failure, are
impotent in the face of hope and joy.
	-- P. J. O'Rourke