Minor, minor style question

Tim Roberts timr at probo.com
Sun Mar 3 19:09:03 EST 2002


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.
--
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list