[Python-ideas] Implicit String Concatenation (original) (raw)

Jason Orendorff jason.orendorff at gmail.com
Wed Apr 11 20:01:59 CEST 2007


On 4/11/07, Eoghan Murray <eoghan at qatano.com> wrote:

This is exactly what I'm proposing. You could spell it juxta short for juxtaposition or concat, and overload it as usual :-)

And if juxta is not defined, it should fall back first on call, then mul, then add. If it binds right-to-left, you could write things like

from math import * print (2 sin x + cos x)

We might as well make newlines an operator at the same time. There's precedent for this in Haskell, and good synergy--adding the STM monad to Python would solve the GIL problem. You could spell that operator bind or just >>=, take your pick.

And I think Guido already committed to ripping out the @decorator syntax in Py3k in favor of comment overloading, via rem().

Just kidding, of course...

Anyone with any positive reactions?

Eoghan, thanks for taking the time to write. I don't think anyone likes the idea, though. It causes many grammatical problems: should a[0] parse as a.getitem(0) or a.juxta([0])? What about (foo)(bar)? And while "sin x" would of course mean sin.juxta(x), "sin -x" would parse as "sin - x", or sin.sub(x).

A few extra + signs are a small price to pay.

-j



More information about the Python-ideas mailing list