# [Python-Dev] Infix operators

Sebastien Loisel loisel at temple.edu
Thu Jul 24 01:48:06 CEST 2008

```Dear Josiah,

On Wed, Jul 23, 2008 at 7:11 PM, Josiah Carlson <josiah.carlson at gmail.com>
wrote:

> What the heck does 'x = 4 \$ 6' mean in Python?  Oh, that's right, it's
> a custom infix operator.  But where is it defined?  In the module?  In
> some other module that is imported?  Can I override or do some
> pre-processing to the arguments and pass it on to the previously
> defined \$ operator?  So many questions, none of which tell me what '\$'
> does.
>

My question is really what the history of this thing is and what sort of
opposition there is to this idea, in the python community. From your email,
I suspect that this conversation has already taken place.

I'm not going to become a python developer/politician and try to push this,
my job involves teaching and research in mathematics and the programming
language is just a tool. If I want to "put food on my family" (in the words
of a wise man), I can't really spend a whole lot of time on this mailing
list debating this.

However, just for posterity (and I'm not going to pursue the argument
further than this), I'll say this. The problem of determining the meaning
(or overridability or whatever) of x=4\$6 is the same as the problem of
determining the meaning of x=fooz(4,6). Since it's not a good argument
against user-defined functions, I don't see it as a good argument against
user-defined operators. Of course, obviously the LISP people have decided
that fooz(4,6) (or rather, (fooz 4 6)) is okay, and 4\$6 is not, so who am I
to dispute that.

> If you still think that X \ Y would honestly make Python a better

Well, I'm not arguing for adding one more special-purpose operator, because
probably the need for more operators will never end. If arbitrary operators
were defined like ordinary functions, they could be brought in with the
import numeric or whatever, and docstrings could be looked up, etc...

>
> language, I would ask you if logix
> (http://www.livelogix.net/logix/intro.html) would suit you better.  It
> seems to allow you to use arbitrary punctuation for operators.
>

Thank you for the pointer. I have taken a look and it does look interesting,
on first blush I would love to use that language. The main thing is that I
worry about being out on the fringe, using a language that nobody uses, and
which may get abandoned without warning (like Sun abandoned `self'), or be
buggier just because people don't use it... Although I love metaprogramming
and I would use it if it were in python, I don't really need to go that far
(arbitrary infix operators would suffice to me.)

Sincerely,

--
Sébastien Loisel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20080723/4e31179b/attachment.htm>
```