Minor, minor style question
m.faassen at vet.uu.nl
Tue Mar 5 13:13:48 CET 2002
Cameron Laird <claird at starbase.neosoft.com> wrote:
> Why would I prefer
> string = ""
> string = string + "abc "
> string = string + "def "
> string = string + "xyz"
> string = "abc " + \
> "def " + \
> ? I see a lot of the former in contexts I associate
> Is there an attraction to the redundancy (and fragil-
> ity!) I'm missing? Are \-s *so* deprecated?
Note that a very pleasant alternative for strings in Python is:
s = ("abc "
Frequently the brace context is already taken care of anyway, such
as in function calls:
"baz", 1, 15)
Generally I try to avoid \ using tricks like this, though I'm not religious
about it. Sometimes a backslash is nicest.
History of the 20th Century: WW1, WW2, WW3?
No, WWW -- Could we be going in the right direction?
More information about the Python-list