Discussion: Introducing new operators for matrix computation

Bjorn Pettersen bjorn at roguewave.com
Fri Jul 14 20:10:27 EDT 2000


Huaiyu Zhu wrote:
> 
> On Fri, 14 Jul 2000 11:38:51 -0600, Bjorn Pettersen <bjorn at roguewave.com>
> wrote:
> >
> >Well, this could actually be generally useful, but not with the .+
> >syntax (since the dot would interfer with methods on the sequence
> >object).

You're quoting me out of context here. What I could find generally
useful is a way to spell component-wise operations...

> My impression from the python-dev list is that this is not the case.  Some
> say it is easy to distinguish
> 
> a. + b
> a .+ b
[snip]

As you might have guessed, I don't really care what is done in the
matrix case -- I don't use matrices.  If a component-wise "operator"
were to be added to Python however, I would expect it to work with e.g.
list and in that case a dot is ambigous:

  mylist.foo()  # are you calling the foo method on the list or the
elements?

I have a feeling that what you really want these operators to do is
paralell component-wise operations on more than one collection object
though, which is exactly what list comprehensions do (in a general way).

-- bjorn




More information about the Python-list mailing list