[Python-ideas] Implicit String Concatenation

Eoghan Murray eoghan at qatano.com
Wed Apr 11 11:38:43 CEST 2007


I heard the call for the P3K PEP April deadline, so I thought I better get
this sent off!

When I was first exposed to Python, I was delighted that I could do the
following;
>>> "Hello" ' world'
    'Hello world'
This turned to confusion when I tried;
>>> domain = " world"
>>> "hello" domain
Syntax Error ... Invalid Syntax

My proposal for Python3K is to allow string-concatenation via juxtaposition
between string-literals, string-variables and expressions that evaluate to
strings.
Juxtaposition has some precedence in Python (the example above) and also in
the awk programming language.

If anyone agrees that this is a good idea, then I'd be happy to write up a
PEP explaining why I think that implicit string concatenation is better than
overloading the plus operator (which this proposal wouldn't deprecate) and
more elegant than template strings or string interpolation.

Eoghan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20070411/d65363db/attachment.html>


More information about the Python-ideas mailing list