[Python-ideas] Implicit String Concatenation

Neil Toronto ntoronto at cs.byu.edu
Thu Apr 12 17:39:47 CEST 2007


Jan Kanis wrote:
> On Wed, 11 Apr 2007 23:54:11 +0200, Terry Reedy <tjreedy at udel.edu> wrote:
>   
>> | what I'm proposing is the following:
>> |
>> | x = 'foo
>> |     'bar
>> |     'baz'
>>
>> -1 Looks ugly to me ;-)
>>     
>
> Indeed, I don't really like this syntax. I do like if there'd be a way to  
> spell 'multiline string with indentation chopped off'. The easiest way  
> (syntax-wise) would be to just have tripple quote do that, but that's  
> gonna give backward compat problems.
>   

These cases would be fine:

        a = """Some text.
    Some more text."""

    def f(x):
        """"Translates x into Hungarian.
        Does it quite badly."""
        pass

This wouldn't:

    a = """Some text.
        Some intentionally indented text."""

How often do people rely on those tabs or spaces being preserved?

Neil




More information about the Python-ideas mailing list