Are line continuations needed?

Peter Maas peter.maas at mplusr.de
Thu Apr 8 08:47:30 EDT 2004


Peter Otten wrote:
>>d = { 'key1' : 'A very very long string of several hundred '\
>>           'characters. I could use a multi-line string but '\
[...]
>>>>d = {1: "Hi Peter, "
> 
> ...         "what do you "
> ...         "think of this?"}

You got me :) I know implicit line continuation but thought that
it applies only to cases where the strings are direct elements of
the bracket like in ["s1", "s2"]. OK, then my example should read

s = 'A very very long string of several hundred '\
     'characters. I could use a multi-line string but '\
[...]

If there are more than three lines you will type less with a
pair of brackets.

Mit freundlichen Gruessen,

Peter Maas

-- 
-------------------------------------------------------------------
Peter Maas, M+R Infosysteme, D-52070 Aachen, Hubert-Wienen-Str. 24
Tel +49-241-93878-0 Fax +49-241-93878-20 eMail peter.maas at mplusr.de
-------------------------------------------------------------------



More information about the Python-list mailing list