On 10/18/2012 12:26 PM, Chris Angelico wrote: > On Fri, Oct 19, 2012 at 3:16 AM, Evan Driscoll <drisc...@cs.wisc.edu> wrote: >> Python isn't as bad as C++ though (my main other language), where >> 80 characters can go by *very* quickly. >> >> 2. Backslash continuations are *terrible*. I hate them with a firery >> passion. :-) A line could be 1000 characters long and it would be >> better than a 120-character line backslash-continued. > I have one mid-sized C++ project at work that's pretty much > exclusively under my control. There is precisely ONE place where > backslash continuations crop up, and that's long strings that want to > be formatted on multiple lines (eg huge SQL statements) - in Python, > they'd be trip-quoted. We don't have *any* backslash continuations in > Python code. > >
But both C++ and Python have automatic concatenation of adjacent strings. So you can just start and end each line with a quote, and leave off the backslash. Similarly, if you need a newline at the end of each line, you can use the \n just before the trailing quote. Naturally I agree with you that this case is better handled in Python with triple-quote. I never use the backslash at end-of-line to continue a statement to the next. Not only is it a readability problem, but if your editor doesn't have visible spaces, you can accidentally have whitespace after the backslash, and wonder what went wrong. -- DaveA -- http://mail.python.org/mailman/listinfo/python-list