Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #31665
| Date | 2012-10-18 12:47 -0400 |
|---|---|
| From | Dave Angel <d@davea.name> |
| Subject | Re: A desperate lunge for on-topic-ness |
| References | <CANaSqUfLX7V2OxhO+fdVtmQcDzNfEgQfutHak_G-9_1_4nNr1Q@mail.gmail.com> <50802B5B.6040902@cs.wisc.edu> <CAPTjJmqGmYHD7vTdWdSq-Ro4ZCv2z=3zea92iahy-7Qx4=NoOg@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2454.1350578890.27098.python-list@python.org> (permalink) |
On 10/18/2012 12:26 PM, Chris Angelico wrote: > On Fri, Oct 19, 2012 at 3:16 AM, Evan Driscoll <driscoll@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
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: A desperate lunge for on-topic-ness Dave Angel <d@davea.name> - 2012-10-18 12:47 -0400
Re: A desperate lunge for on-topic-ness Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-10-19 01:20 +0000
Re: A desperate lunge for on-topic-ness Dave Angel <d@davea.name> - 2012-10-18 22:00 -0400
csiph-web