[Python-ideas] Implicit string literal concatenation considered harmful?
MRAB
python at mrabarnett.plus.com
Fri May 17 00:19:38 CEST 2013
On 16/05/2013 21:51, Andrew Barnert wrote:
> From: MRAB <python at mrabarnett.plus.com>
>
> Sent: Thursday, May 16, 2013 9:23 AM
>
>> On 16/05/2013 16:57, Andrew Barnert wrote:
>
>>> And then there's the fact that the "precedence" is different
>>> depending on which meaning the dot gets. Remember that what
>>> you're trying to solve is the problem that member-dot and % both
>>> have higher precedence than +.
>>>
>> I thought the problem we were trying to solve was that "+" has a
>> lower precedence than "%" and attribute/method access, so implicit
>> concatenation that's followed by "%" or ".format" can't be replaced
>> by "+" without adding extra parentheses.
>
> I was talking about the fact that Guido's 'Just use "+"' suggestion
> is insufficient, because it requires adding extra parentheses.
> Therefore, the problem we're trying to solve is 'member-dot and %
> both have higher precedence than +.' Your '"+" has a lower precedence
> than "%" and attribute/method access' means the exact same thing,
> just stated in the opposite order.
>
> So… I think I'm missing your point.
>
You said """there's the fact that the "precedence" is different
depending on which meaning the dot gets""".
My point was that "." between string literals (which is currently a
syntax error) would indicate concatenation of those literals, but there
would be no change in precedence; it wouldn't replace "+".
More information about the Python-ideas
mailing list