Minor, minor style question

Emile van Sebille emile at fenx.com
Fri Mar 1 14:05:41 EST 2002


claird at starbase.neosoft.com (Cameron Laird) writes:

> Why would I prefer
>   string = ""
>   string = string + "abc "
>   string = string + "def "
>   string = string + "xyz"
> over
>   string = "abc " + \
>       "def " + \
>       "xyz"
> ?

Isn't the question about line continuations?  I don't use them (except
on rare occasions), preferring to do something more like:

string = ('abc' +
    'def' +
    'xzy')

As to deprecation, a quick scan of the 2.2 standard library shows 42516
lines of which 249 used '\' style continuations, and other styles
accounting for 958.  (Note: I count a line as a sequence of source lines
that together tokenize properly.)

HTH,

--

Emile van Sebille
emile at fenx.com

---------




More information about the Python-list mailing list