Discussion: Introducing new operators for matrix computation
Huaiyu Zhu
hzhu at knowledgetrack.com
Fri Jul 14 19:12:58 EDT 2000
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).
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
Some say it is difficult. But the first is a syntax error anyway.
The only real danger is
3. + a
3 .+ a
But in this case pointwise operation does not make sense.
So I suppose the following rules would resolve all the ambiguities:
Dot binds with preceding number. Otherwise it binds with following
operator. Otherwise it is a member indicator. Otherwise it is syntax error.
Examples:
2.+b
a.+b <-- only this is new
a.b
a.3
--
Huaiyu Zhu hzhu at users.sourceforge.net
Matrix for Python Project http://MatPy.sourceforge.net
More information about the Python-list
mailing list