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

Nick Coghlan ncoghlan at gmail.com
Sat May 11 18:49:14 CEST 2013


On Sun, May 12, 2013 at 2:48 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On Sun, May 12, 2013 at 2:37 AM, Christian Tismer <tismer at stackless.com> wrote:
>
>> So if there was some notation (not specified yet how) that triggers correct
>> indentation at compile time without extra functional hacks, so that
>>
>>     long_text = """
>>       this text is left justified
>>         and this line indents by two spaces
>>       """
>>
>> is stripped the leading and trailing \n and indentation is justified,
>> then I think the need for the implicit whitespace operator would be small.
>
> Through participating in this thread, I've realised that the
> distinction between when I use a triple quoted string (with or without
> textwrap.dedent()) and when I use implicit string concatenation is
> whether or not I want the newlines in the result. Often I can avoid
> the issue entirely by splitting a statement into multiple pieces, but

... not always.

(Sorry, got distracted and left the sentence unfinished).

Cheers,
Nick.

--
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-ideas mailing list