[Python-ideas] Implicit string literal concatenation considered harmful?

MRAB python at mrabarnett.plus.com
Thu May 16 21:29:11 CEST 2013


On 16/05/2013 20:03, Joao S. O. Bueno wrote:
> On 16 May 2013 12:57, Andrew Barnert <abarnert at yahoo.com> wrote:
>> And this means the parser has to figure out whether you mean dot for attribute access or dot for concatenation. That's not exactly a _hard_ problem, but it's not _trivial_.
>
> If you say it mis not hard for the parser, ok - but it seems
> impossible for humans:
>
> upper = " World"
> print ("Hello". upper)
>
That's attribute access.

The suggestion was to use it in place of implicit string concatenation,
which occurs only between string _literals_:

print ("Hello" . " World")

and is currently illegal ("SyntaxError: invalid syntax").


More information about the Python-ideas mailing list