Are line continuations needed?

Peter Otten __peter__ at web.de
Wed Apr 7 12:55:52 EDT 2004


Peter Maas wrote:

> Russell Wallace wrote:
>> Python lets you continue a single logical line across more than one
>> physical line, either by putting a \ at the end or letting it happen
>> automatically with an incomplete infix operator.
>> 
>> I'm wondering how often is this feature needed? Would there be any
>> problems if it weren't part of the language?
> 
> Just had this example:
> 
> d = { 'key1' : 'A very very long string of several hundred '\
>            'characters. I could use a multi-line string but '\
>            'then either left white space would be part of the '\
>            'string or I would have to align it at column 0 '\
>            '(ugly). I could embed it into a pair of brackets '\
>            'but I see no advantage over \\. Finally I could '\
>            'put this string on a single line (also ugly and hard '\
>            'to read).'
>        ...
>      }

>>> d = {1: "Hi Peter, "
...         "what do you "
...         "think of this?"}

Peter




More information about the Python-list mailing list