Are line continuations needed?
Josiah Carlson
jcarlson at uci.edu
Fri Apr 9 00:12:06 EDT 2004
Graham Breed wrote:
>> I think that you might find there wasn't any indentation to lose. Read
>> the point more carefully and you might see he has a valid concern.
>> Consider this (none of the lines are indented):
>>
>> mystring = """\
>> +---------------+
>> | '" |
>> +---------------+
>> """
>>
>> Without a line continuation there simply isn't any way to write this
>> string and still have the box characters line up neatly.
>
>
> mystring = """
> +---------------+
> | '" |
> +---------------+
> """[1:]
>
What about Windows? You'd need to use [2:].
I would also say that the trailing string slice is ugly.
- Josiah
More information about the Python-list
mailing list