On Thu, 21 May 2015, Luciano Ramalho wrote:

You can escape the newline and the end of a line by typing "\" as the
last character, but I think this is ugly and error prone and I avoid
it whenever I can -- which is almost always.

Luciano,

  Thanks. That's what I commonly use, but haven't applied to python.

- Whenever you open a parenthesis, brace or bracket, every newline is
considered as plain space by the parser. Very often, adding parenthesis
around an expression does not change it's meaning, so that's one way to
make one logical line span multiple physical lines without resorting to
"\".

  This is how it works with long wxPython widget strings. I did not make the
connection to enclosing characters.

- Two or more string literals with no intervening tokens except
whitespace are parsed as a single string literal.

  Unless the string is delineated with single quotes (as in a content list
for a drop-down picklist control). :-)

  I'm used to seeing (and writing) newlines in bash scripts and other text
so now I know python recognizes it I can use this solution.

Much appreciated,

Rich
_______________________________________________
Portland mailing list
[email protected]
https://mail.python.org/mailman/listinfo/portland

Reply via email to