Re: Multiline code - trailing slash usage

2007-03-15 Thread Ben Finney
"abcd" <[EMAIL PROTECTED]> writes: > When do I need to use a trailing slash to separate code over multiple > lines. > > For example: > > x = "hello world, this is my multiline " + \ > "string" You can either do that, or you can use parentheses: x = ( "foo" + "bar" ) Note

Re: Multiline code - trailing slash usage

2007-03-15 Thread Duncan Booth
Steve Holden <[EMAIL PROTECTED]> wrote: > x = "hello world, this is my multiline " \ > "string" > > and this would have saved you a run-time string concatenation :) or use parentheses for an alternative which doesn't need the backslash: x = ("hello world, this is my multiline "

Re: Multiline code - trailing slash usage

2007-03-15 Thread Christoph Haas
On Thursday 15 March 2007 15:57, abcd wrote: > When do I need to use a trailing slash to separate code over multiple > lines. > > For example: > > x = "hello world, this is my multiline " + \ > "string" Needed. Although you can omit the "+". > x = {'name' : \ > 'bob'} Not needed b

Re: Multiline code - trailing slash usage

2007-03-15 Thread Bruno Desthuilliers
abcd a écrit : > When do I need to use a trailing slash to separate code over multiple > lines. > > For example: > > x = "hello world, this is my multiline " + \ > "string" Here you don't need the + > x = {'name' : \ > 'bob'} And here you don't need the antislash > Do I need to

Re: Multiline code - trailing slash usage

2007-03-15 Thread Steven Bethard
abcd wrote: > When do I need to use a trailing slash to separate code over multiple > lines. > > For example: > > x = "hello world, this is my multiline " + \ > "string" Yes. > > x = {'name' : \ > 'bob'} No. You don't need trailing slashes whenever there's a pair of {}, [] or

Re: Multiline code - trailing slash usage

2007-03-15 Thread Larry Bates
abcd wrote: > When do I need to use a trailing slash to separate code over multiple > lines. > > For example: > > x = "hello world, this is my multiline " + \ > "string" > > x = {'name' : \ > 'bob'} > > Do I need to use the "\" in the above examples? When do i need to use > it?

Re: Multiline code - trailing slash usage

2007-03-15 Thread Steve Holden
abcd wrote: > When do I need to use a trailing slash to separate code over multiple > lines. > > For example: > > x = "hello world, this is my multiline " + \ > "string" > > x = {'name' : \ > 'bob'} > > Do I need to use the "\" in the above examples? When do i need to use > it?

Multiline code - trailing slash usage

2007-03-15 Thread abcd
When do I need to use a trailing slash to separate code over multiple lines. For example: x = "hello world, this is my multiline " + \ "string" x = {'name' : \ 'bob'} Do I need to use the "\" in the above examples? When do i need to use it? -- http://mail.python.org/mailman/li