[Python-ideas] Implicit string literal concatenation considered harmful?
Joao S. O. Bueno
jsbueno at python.org.br
Fri May 17 11:55:20 CEST 2013
On 16 May 2013 16:29, MRAB <python at mrabarnett.plus.com> wrote:
> 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.
But you are suggesting it should be string concatenation.
It is already in use for attribute access, as you can see -
and one writting a program, or reading one should not
have to be thinking """ah - but here I can't use the "." because
I am concatenating a string in a variable, not a literal
string""""
>
> 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").
What is that? One thing that works in a way for literals and
in another way for expressions?
Sorry, but there is onlye one word for this: Insanity!
More information about the Python-ideas
mailing list