
On May 10, 2013, at 09:28 PM, M.-A. Lemburg wrote:
Would it be reasonable to start deprecating this and eventually remove it from the language?
I'm pretty mixed. OT1H, you're right, it's a common mistake and often *very* hard to spot. A SyntaxWarning when it appears on a single line doesn't help because I'm much more likely to forget a trailing comma in situations like: files = [ '/tmp/foo', '/etc/passwd' '/etc/group', '/var/cache', ] (g'wan, spot the missing comma ;). OTOH, doing things like:
s = ('abc\n' 'def\n' 'ghi\n') t = ('some long paragraph spanning multiple lines in an editor, ' 'without newlines')
Is pretty common in code I see all the time. I'm not sure why; I use it occasionally, but only very rarely. A lot of folks like this style a lot though from what I can tell.
This looks and works much better than triple-quoted string literals, esp. when defining such string literals in indented code.
I also see this code a lot: from textwrap import dedent s = dedent("""\ abc def ghi """) I think having to deal with indentation could be a common reason why people use implicit concatenation instead of TQS. All things considered, I think the difficult-to-spot bugginess of implicit concatenation outweighs the occasional convenience of it. -Barry