Minor, minor style question

Mats Wichmann mats at laplaza.org
Mon Mar 4 09:23:34 EST 2002


On Sun, 03 Mar 2002 16:09:03 -0800, Tim Roberts <timr at probo.com>
wrote:

:claird at starbase.neosoft.com (Cameron Laird) wrote:
:
:>Why would I prefer
:>  string = ""
:>  string = string + "abc "
:>  string = string + "def "
:>  string = string + "xyz"
:>over
:>  string = "abc " + \
:>	      "def " + \
:>	      "xyz"
:>?  I see a lot of the former in contexts I associate
:>with Visual Basic- or JavaScript-majority folkways.
:>Is there an attraction to the redundancy (and fragil-
:>ity!) I'm missing?  Are \-s *so* deprecated?
:
:Visual Basic programmers write things this way because VB didn't support
:line continuation characters until relatively recently.  Until then, you
:either had to write your concatenated strings as one VERY long line, or via
:your first method.

I'm far from being a Javascript expert, but I thought it was missing
there, too. My one bit of Javascript coding a few years back I ended
up having to do something like this to make mutiline text messages.
Of course, Python can do the multiline messages natively...
Mats Wichmann




More information about the Python-list mailing list