[Python-3000] What makes infix operators special? (was Re: Type parameterization (was: Re: Type annotations: annotating generators))
Guido van Rossum
guido at python.org
Sun May 21 17:31:53 CEST 2006
On 5/21/06, Nick Coghlan <ncoghlan at gmail.com> wrote:
> Something I've occasionally wondered about is just what it is that makes
> operators so much more convenient than methods or builtin functions for some
> operations.
Lambert Meertens, ABC's primary author, once explained this to me in a
way that made sense to me.
Some of the oldest operators (in the history of
arithmetic/mathematics) are + and * (or whatever multiplication
operator was first). These operators are associative: (a+b)+c ==
a+(b+c). There's also distributive law: a*(b+c) == a*b + a*c. And of
course they are symmetric: a+b == b+a. Properties like that *visually*
(at least this is Lambert's theory) help you see equivalences when
doing mathematical proofs much easier than when you limit yourself to
functional notations.
(This might also explain why unary operators are relatively scarce;
they don't have any of these properties so they don't buy you as
much.)
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-3000
mailing list