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

Ethan Furman ethan at stoneleaf.us
Mon May 20 15:26:37 CEST 2013


On 05/10/2013 05:36 PM, Michael Mitchell wrote:
> On Fri, May 10, 2013 at 7:08 PM, Alexander Belopolsky wrote:
>
>     Does this earn a point?
>
>     x = (+ 'foo\n'
>
>           + 'bar\n'
>           + 'baz\n'
>          )
>
>
> Plus doesn't make sense as a unary operator on strings.
>
> x = ('foo\n' +
>       'bar\n' +
>       'baz\n' +
>       '')
>
> This would work.

Except your last line is now an empty string, and still with no trailing +.

--
~Ethan~


More information about the Python-ideas mailing list