Matlab vs Python (was RE: Discussion: Introducing new operators f

jacobs at darwin.epbi.cwru.edu.bbs jacobs at darwin.epbi.cwru.edu.bbs
Mon Jul 17 15:50:04 EDT 2000


I've held back a few times from contributing my 0.02 cents, but here goes:

1) Python is a nifty language that allows its programmers to revel in
   the richness of its dynamic object model.

2) Such models are always subject to abuse and can result in horrible and
   unmaintainable hacks.  These are frequently disguised as nifty syntactic
   'features'.

3) Such attempts are bound to lead to terminal feeping-creaturism if not
   carefully kept out of the core language.

Ok, we all know this.  Most of us accept it.  Lets move on.  Thus far, I am
in line with the main-stream non-linear algebra proponents. However, I'd
love to see clean linear algebra implemented in Python.  So the dilemma is
how to make the marriage work.

First, Huaiyu has done an outstanding job as not only an advocate, but
implementor, of such a hybrid system.  This is always the first step.
People can complain about the lack of something from now until doomsday, but
without someone at bat nothing will ever happen.  So, we have a critical
mass.  Now what?  Now he is asking for advice and guidance.  And what do we
tell him?  I'm sure that both (all) camps know their party lines at this
point, but it seems to me that little constructive has been done to work
around the issues.  So, here I go.  Brainstorming...

Silly idea 1:

  Until add-on Python grammar modules are available, what about a PyAlgebra
  evaluator module.  For a precedent, see regular expressions.  The
  difference is that linear-algebra syntax can be made too Python-like for
  some tastes.

  e.g.:

  import PyAlgebra

  PyAlgebra.run(r'A = (A .* B)\C')
  e = PyAlgebra(r"D = A'*B")
  e.run() # or e()

Admittedly, its not perfect, nor optimally compact, but it is no longer
encumbered by having to support the full Python grammar and is free to
redefine as much as necessary.

Silly idea 2:

  How about a "Linear-Algebra Python" to "Stock Python" translator.  Parsing
  Python isn't rocket science, so a fairly simple source-to-source
  translator can hide all the new syntax and turn it into redistributable
  stock but ugly Python code.  No fuss or muss, assuming that the original
  source is available when necessary.

Silly idea 3:

  Lets continue arguing until everyone, both pro and con, gets irritated,
starts calling each other Nazis and gives up.

Feel free to chime in!

-Kevin


--
----------->  Kevin Jacobs  <-----------|------->  (216) 778-8211  <--------
S.A.G.E. Project Technical Coordinator  | Department of Epidemiology
  & System Administrator                |   & Biostatistics
Internet E-mail: jacobs at darwin.cwru.edu | Case Western Reserve University
----------------------------------------------------------------------------



More information about the Python-list mailing list