style question

Hari Sekhon sekhon.hari at googlemail.com
Mon Jun 26 05:21:52 EDT 2006


MTD wrote:
> Hari Sekhon wrote:
>   
>> Is it better to do:
>>
>> message = """This is line1.
>> This is line2
>> This is line3\n"""
>>
>> or
>>
>> message = "This is line1.\n
>> message = message + "This is line2\n"
>> message = message + "This is line3\n"
>>     
>
> Is there any reason you can't do it in one line?
>
> message = "This is line1.\nThis is line2.\nThis is line3.\n"
>
>   
this would also be ugly though, a huge lone line for the paragraph I 
want to output, which would wrap around and break the visual indentation.

otherwise I could do it in one line. but if I was going to do that and 
it was going to be so long, I'd just use """..."""
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060626/716bba46/attachment.html>


More information about the Python-list mailing list