Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #31707
| Date | 2012-10-18 22:00 -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> <mailman.2454.1350578890.27098.python-list@python.org> <5080aadf$0$29971$c3e8da3$5496439d@news.astraweb.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2490.1350612076.27098.python-list@python.org> (permalink) |
On 10/18/2012 09:20 PM, Steven D'Aprano wrote: > On Thu, 18 Oct 2012 12:47:48 -0400, Dave Angel wrote: > >> 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. > What, you don't read the SyntaxError that you will invariably get? > > > # Python 2.7 and 3.3: > > py> x = 42 + \ > File "<stdin>", line 1 > x = 42 + \ > ^ > SyntaxError: unexpected character after line continuation character > > > > Even if you go back to truly ancient Python 1.5: > > [steve@ando ~]$ python1.5 > Python 1.5.2 (#1, Aug 27 2012, 09:09:18) [GCC 4.1.2 20080704 (Red Hat > 4.1.2-52)] on linux2 > Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>>> x = 42 + \ > File "<stdin>", line 1 > x = 42 + \ > ^ > SyntaxError: invalid token > > > Honestly, it's not that hard to diagnose line continuation errors. It's > probably easier to diagnose them than to diagnose missing parentheses. > > The more I hear people dissing line continuation backslashes, the more I > want to use them everywhere. The context was both C++ and python, and I got into the habit of avoiding the continuation characters in C++, where the compiler usually has a totally stupid error, if any. it's been so long since I've used them, it's quite possible I never tried it in python. -- DaveA
Back to comp.lang.python | Previous | Next — Previous 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