Tim Chase
2/26/2008 4:01:00 PM
> I have made this string:
>
> TITLE = 'Efficiency of set operations: sort model,
> (cphstl::set::insert(p,e)^n cphstl::set::insert(e)), integer'
>
> But I am not allowed to break the line like that:
>
> IndentationError: unexpected indent
>
> How do I break a line?
Depends on what you want. You can embed running strings with
newlines using triple-quotes (either single- or double-quotes):
TITLE = """Efficiency...
(cphstl:..."""
Or you can use string concatenation using line-continuations:
TITLE = "Efficiency..." "(cphstl:..."
or using parens
TITLE = ("Efficiency..."
"(cphstl:...")
I like the clean'ness of the first version, but sometimes get
irked by it including my leading whitespace (there are some
workarounds, but all involve more than trivial effort). I tend
to use the 2nd in the case you describe, but usually using the
3rd version in all other cases where it's as a parameter to a
function call or some other bracketed/braced construct.
-tkc