Discussion: new operators for numerical computation

Konrad Hinsen hinsen at cnrs-orleans.fr
Wed Jul 26 05:18:25 EDT 2000


Charles Boncelet <boncelet at eecis.udel.edu> writes:

> After reading numerous posts on the subject of adding more 
> infix operators to Python (e.g., making Python more like Matlab),
> I'm starting to wonder if the proposed solutions are not worse 
> than the original problems.
> 
> A few comments (some plagiarised from others--but I'll try to
> attribute when I remember the source):
> 
> 1. MatPy currently does a pretty good job of addressing many of
> the concerns for linear algebra.  The syntax for inverse (A.I())
> and transpose (A.T()) are both simple and allow for class specific
> implementations (e.g. for a triangular matrix).

You raise an important point: adding operators may not be the best
solution at all.

With the ongoing rework of NumPy that turns arrays into Python classes
with an underlying C implementation, it would be possible to have an
"array" and a "matrix" class with different semantics, but sharing
most of the code and having equal performance. Conversion between the
two would also be possible at basically no cost, and C modules could
be written to accept both.

Having two different classes with different semantics is perfectly
normal in Python. It would only be a problem if there were important
application domains that require both semantics mixed together, but I
am not aware of such domains.
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                            | E-Mail: hinsen at cnrs-orleans.fr
Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.55.69
Rue Charles Sadron                       | Fax:  +33-2.38.63.15.17
45071 Orleans Cedex 2                    | Deutsch/Esperanto/English/
France                                   | Nederlands/Francais
-------------------------------------------------------------------------------



More information about the Python-list mailing list