[Python-Dev] String literal concatenation & docstrings

ort orbitz at drorbitz.ath.cx
Sat Nov 27 05:01:24 CET 2004


Like anything, if you need to wrap a statement around multiple lines, 
you surround it in ()'s

Now the question is why does:
 >>> def foo():
...     ("""blah"""
...     """fejlfe""")
...     pass
...
 >>> help(foo)

Not show that as the doc string. Just because it has () doesn't mean it 
evaluates to anything other than a string as far as I know.



Carlos Ribeiro wrote:

>On Fri, 26 Nov 2004 11:56:05 -0800, Brett C. <bac at ocf.berkeley.edu> wrote:
>  
>
>>Should probably change the wording on that unless people actually want the
>>literal string concatenation to work with statements (docstrings seem like the
>>only place that would be reasonable) unless you want to start allowing print
>>statements to have a string part span multiple lines.  =)
>>    
>>
>
>It means that:
>
>    print "this line continues"
>          "on the next line"
>
>does not work, while the following works:
>
>    a = "this line continues"
>        "on the next line"
>
>Kind of weird, but anyway, that's not a common idiom. One more reason
>to use triple-quoted-strings when printing long strings.
>
>  
>



More information about the Python-Dev mailing list