Discussion: Introducing new operators for matrix computation
Rainer Deyke
root at rainerdeyke.com
Sat Jul 15 01:04:22 EDT 2000
"Bjorn Pettersen" <bjorn at roguewave.com> wrote in message
news:396FABF3.B82E0C2 at roguewave.com...
> mylist.foo() # are you calling the foo method on the list or the
> elements?
A valid point (though not very clearly stated). Suppose that for all X, .X
is the elementwise operator such that:
a = b .X c
is equivalent to:
a = []
for x in range(len(b)):
a.append(b[x] X c[x])
What about situations where X is a function instead of an operator? Should
we allow the following syntax?
a = b..f()
(Equivalent to the following:)
a = []
for x in b:
a.append(x.f())
Is b..f(c) equivalent to this:
a = []
for x in range(len(b))
a.append(b[x].f(c[x]))
or is it equivalent to this:
a = []
for x in b:
a.append(x.f(c))
For that matter, what if X is .+ (or ..+)? Should we allow this:
a = b ..+ c
as equivalent to this:
a = []
for x in range(len(b))
a.append(b .+ c)
There has to be a better way to do elementwise operations.
--
Rainer Deyke (root at rainerdeyke.com)
Shareware action/role-playing games - http://rainerdeyke.com
"In ihren Reihen zu stehen heisst unter Feinden zu kaempfen" - Abigor
More information about the Python-list
mailing list