[Python-ideas] Implicit String Concatenation

Georg Brandl g.brandl at gmx.net
Wed Apr 11 16:21:47 CEST 2007

Eoghan Murray schrieb:
> 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.

No, please! The concatenation of string literals is done in the parser.
Your proposal would move that to runtime and introduce a "whitespace operator".
How would you spell that? How would you overload it? etc.


Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.

More information about the Python-ideas mailing list