Multiline code - trailing slash usage
Steven Bethard
steven.bethard at gmail.com
Thu Mar 15 11:19:30 EDT 2007
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 ()
wrapping things.
I never use trailing slashes -- I just wrap the expression in parentheses.
STeVe
More information about the Python-list
mailing list