Matlab vs Python (was RE: Discussion: Introducing new operators for matrix computation)

John Lull lull at acm.org
Wed Jul 19 10:07:11 EDT 2000


(posted & mailed)

Paul Prescod <paul at prescod.net> wrote:

> This is basically the original proposal slightly reworded. The problem
> is that alot of people think that adding operators without predefined,
> cross-module semantic is un-pythonic. Python allows operator overloading
> but the meaning behind the syntaxes are always well-defined. "+" is for
> addition-like things. "*" is for multiplication-like things. [] for
> indexing-like things, "." for attribute-like things and so forth.

I'm not proposing we change that -- even though someone is *already*
free to abuse the notation by overriding __operatorname__() methods.
People simply don't do it, because they know their software won't get
used if they do.


Do I understand you correctly?

We should not add domain-specific operators, because they clutter the
language without enhancing other domains.

We should not add non-domain-specific operators, because they might be
used differently in different domains.

By that standard, Python should *never* have any new operators.


I'm sorry, I fail to see the problem with *one* operator modifier,
clearly flagged as being domain-specific, and providing well-defined
behavior.  Anyone seeing 'a @* b' *knows* that @* is not traditional
multiplication, and will have some domain-specific behavior.  If
someone wants to misuse @+ to mean 'subtract', frankly I don't think
we need to worry about it -- because their package just won't get
used, and won't be around long.

Regards,
John



More information about the Python-list mailing list