[New-bugs-announce] [issue10545] remove or rewrite "Using Backslash to Continue Statements" anti-idiom

rurpy the second report at bugs.python.org
Fri Nov 26 21:50:32 CET 2010

New submission from rurpy the second <rurpy at yahoo.com>:

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.

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.

assignee: docs at python
components: Documentation
messages: 122477
nosy: docs at python, rurpy2
priority: normal
severity: normal
status: open
title: remove or rewrite "Using Backslash to Continue Statements" anti-idiom

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list