[PYTHON MATRIX-SIG] Forget adding new operators to Python
Guido van Rossum
Thu, 14 Sep 1995 08:44:20 -0400
[The second in a series of short essays on subjects raised in the
Let me be brief on this one: adding new operators (like ".*", "./" or
"\") to the language is no-no. I'm very fond of the fact that nearly
all graphical elements of the Python language correspond pretty
closely to their use in "everyday life" (with the C language
considered to be part of everyday life :-).
I should point out that even though the semantics of operators are
(almost) entirely defined by their operands, their syntax (including
priorities) is not -- the parser doesn't know the operand types.
Another, more practical reason is that adding a new operator requires
changes to many components of the language implementation -- e.g. if
".*" were to be added as a new numeric operator, I'd have to make
changes to every module that implements numbers, if only to add a NULL
The only thing I regret is not having added "**" as an exponentiation
operator -- this may happen someday (contributions accepted!).
Oh, and there's also agreement that operators like "+=", "*=" should
eventually be added; though not "++" and "--".
--Guido van Rossum <guido@CNRI.Reston.VA.US>
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: email@example.com
administrivia to: firstname.lastname@example.org