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

Paul Prescod paul@prescod.net
Thu, 13 Jul 2000 17:49:12 -0500


Huaiyu Zhu wrote:
> 
> ...
> 
> So if I ask more I shall get the bit I wanted.  When would this wonderful
> new parser be available so that I can change the syntax beyond recognition?
> :-)

It all depends on who works on it and how hard they work. I really can't
predict. There some Python features that I thought were years away and
appeared from nowhere (cyclic gc) and others that seem perpetually on
the verge of being available (e.g. a compiler that achieves order of
magnitude performance improvements). If I had to pick a version number
out of the wind I would say 2.1 or 2.2. I would predict the same
timeline for any new operators.

By the way, there is already a language specifically designed to allow
people with particular interests to extend the syntax fairly
arbitrarily. It is called REBOL. I think TCL is also a little more
forgiving about syntactic variance. There may be others.

> I don't believe python should be bond to this heritage as much as perl does.
> Maybe those who do matrix have not joined yet.  To justify support by the
> number of existing users sounds like a self-fulfilling prophacy.

It isn't the existing users. It's the users that we see around us. I
don't remember anyone ever asking me for help using Python for matrices,
at any company I have ever worked at. Obviously you live in a different
world. Either of our perceptions could be skewed.

Perhaps the best bet would be for you to make a matrix variant of Python
so popular that we could see the audience in terms of downloads and
discussions.

> Now compare what's written in matlab/octave
> 
>         (X'*X)\(X'*y)
> 
> with what's written in python
> 
>          matrixmultiply(inverse(matrixmultiply(transpose(X), X)),
>                         (matrixmultiply(transpose(X), y[:,NewAxis])))

There must be a more compact syntax! Even without knowing the semantics:

from matrix import tickmult, backslash

backslash( tickmult( X, X ), tickmult( X, y ))

> Now look at the total number of users of matlab/octave, and ask: Is python
> really so inferior that most of them wouldn't switch to python?

I have no idea. If the primary difference between expensive matrix
packages and Python is syntax, perhaps you and I should incorporate and
exploit that market inefficiency. :)

> To change this status does not even need native support of matrix.  The only
> thing required is that there be enough binary operators to be overridden by
> applications - any application that needs additional binary operators.

Michael Hudson has a tagline that made me laugh out loud:

  I saw `cout' being shifted "Hello world" times to the left and
  stopped right there.
                                                    -- Steve Gonedes

He's talking about the random-seeming overloadings you get in C++
because there are so many overloadable operators and they are so poorly
defined. Anyhow, what if I want a different syntax for the XML
operators. "->" and "<-" might be useful.

I am half-tempted to suggest a system where anyone could add new
operators, perhaps in quotes or back-ticks or something but I am very
afraid of what happens when the people who evented "cout shifting" get
their hands on it!

> But I can see its use now.  I have to get your reply from web and cut and
> paste in order to reply again. :-(

How long until some enterprising Python programmer makes a utility that
polls the website, and generates an email version of each message as it
appears? :)

-- 
 Paul Prescod - Not encumbered by corporate consensus
Simplicity does not precede complexity, but follows it. 
	- http://www.cs.yale.edu/~perlis-alan/quotes.html