classification
Title: remove or rewrite "Using Backslash to Continue Statements" anti-idiom
Type: Stage:
Components: Documentation Versions:
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Re-title the "Using Backslash to Continue Statements" anti-idiom
View: 7391
Assigned To: docs@python Nosy List: docs@python, rurpy2, terry.reedy
Priority: normal Keywords:

Created on 2010-11-26 20:50 by rurpy2, last changed 2010-12-08 20:25 by terry.reedy. This issue is now closed.

Messages (2)
msg122477 - (view) Author: rurpy (rurpy2) Date: 2010-11-26 20:50
The Python HOWTOs->Idioms and Anti-Idioms has a section
"Using Backslash to Continue Statements".

It says that line continuation is "dangerous" and gives two reasons.

1. Hard to see a space after the backslash.

This is not "dangerous" as it cause an impossible-to-miss syntax 
error (as pointed out in the following sentence.)

2. It can cause other "subtle" errors. 

It gives a code example purporting to demonstrate this but without
saying what the input data to the code is or what the resulting
problem is.  I spent a while trying to figure it out unsuccessfully.

In  
http://www.mail-archive.com/python-list@python.org/msg249344.html
a number of c.l.p regulars did not figure it out either.

I also note related bug http://bugs.python.org/issue7391 that points
out that avoinding backslashed continuations with parens is not 
always possible.

So I suggest...

1. If the the given example actually illustrates a real problem,
document clearly what it is.  This is a reference manual, not a
quiz book.

2. If not, then remove that argument.  Now the only reason for
not using backslashes is that a hard-to-see space after the
backslash will cause a syntax error.  That is neither dangerous
or a strong reason not to do it.  An unstated reason is that 
PEP-8 recommends against it but its recommendation is not absolute
and is based only on aethtetics.  With no real arguments against
using it other than style, it should not be documented as an anti-idiom, recommendations against it should remain only in
PEP-8 with other such style guidelines, and this section should 
be removed from the Anti-Idioms chapter.
msg123644 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-12-08 20:25
This is essentially a duplicate of #7391 where it is already agreed that a change should be made to that section.
History
Date User Action Args
2010-12-08 20:25:03terry.reedysetstatus: open -> closed

nosy: + terry.reedy
messages: + msg123644

superseder: Re-title the "Using Backslash to Continue Statements" anti-idiom
resolution: duplicate
2010-11-26 20:50:16rurpy2create