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

Andrew Barnert abarnert at yahoo.com
Thu May 16 22:51:40 CEST 2013


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.



More information about the Python-ideas mailing list