This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rurpy2
Recipients docs@python, rurpy2
Date 2010-11-26.20:50:16
SpamBayes Score 2.6127156e-10
Marked as misclassified No
Message-id <1290804632.88.0.494003444216.issue10545@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2010-11-26 20:50:32rurpy2setrecipients: + rurpy2, docs@python
2010-11-26 20:50:32rurpy2setmessageid: <1290804632.88.0.494003444216.issue10545@psf.upfronthosting.co.za>
2010-11-26 20:50:16rurpy2linkissue10545 messages
2010-11-26 20:50:16rurpy2create