Are line continuations needed?

Michael Geary Mike at DeleteThis.Geary.com
Wed Apr 7 17:28:57 EDT 2004


John Roth wrote:
> [Backslash line continuations are], I believe, planned for
> removal in 3.0. Remember that 3.0 will break everything
> anyway: it's the release for incompatible changes.

If this is true, it will put Python at a disadvantage compared to Perl with
regard to multiline strings. I thought David Bolen's example was pretty
compelling.

Without the backslash continuation, you're forced to write multiline strings
with the first line indented differently from the rest of the lines:

mystring = """first line
second line
third line"""

Yuck.

Backslash continuation fixes this, as David showed:

mystring = """\
first line
second line
third line"""

Maybe there will be some other way to do clean multiline strings in Python
3.0?

-Mike





More information about the Python-list mailing list