classification
Title: Re-title the "Using Backslash to Continue Statements" anti-idiom
Type: Stage:
Components: Documentation Versions: Python 3.2, Python 3.3
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Horpner, eric.araujo, ezio.melotti, fossilet, georg.brandl, moshez, orsenthil, pitrou, python-dev, r.david.murray, rhettinger, rurpy2, terry.reedy
Priority: low Keywords:

Created on 2009-11-24 14:19 by Horpner, last changed 2012-06-24 11:21 by fossilet.

Messages (12)
msg95676 - (view) Author: Neil Cerutti (Horpner) Date: 2009-11-24 14:19
This "anti-idiom" is in the Python HOWTOs->Idioms and Anti-Idioms

The current title is "Using Backslash to Continue Statements"

However, using the line continuation character won't cause mysterious
problems in statements, but only in certain expressions, as the article
goes on to explain.

Moreover, the proposed solution of wrapping expressions in parentheses
is a syntax error in a statement, e.g.:

with (open(roster_path, 'r') as roster_file,
      open(disb_path, 'w') as out_file,
      open(report_path, 'w') as report_file):
File "C:\project\codxml.py", line 184
   with (open(roster_path, 'r') as roster_file,
                                   ^
SyntaxError: invalid syntax

I suggest that the title be changed to "Using Backslash to Continue
Expressions."

I'm sorry I don't know for sure when this HOWTO was first included in
the normal Python distribution.
msg95702 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2009-11-24 22:45
As you write, the parentheses "trick" only works in expressions (what
you tried to wrap in your with statement is not an expression).

The backslash works for all kinds of statements however, so the
suggested change is wrong.
msg95720 - (view) Author: Neil Cerutti (Horpner) Date: 2009-11-25 17:01
Yes, I know. That's why I feel it should not be labeled an anti-idiom,
as it currently seems to be.
msg95721 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2009-11-25 17:13
Agreed.
msg123643 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-12-08 20:24
In #10545, 'rurpy2' gives a similar critique of this section and suggests that it be improved or removed. I agree that it needs change and will try to think of what would be better.
msg123646 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2010-12-08 20:27
I'll take that section out.
msg130722 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-03-13 03:31
New changeset e34b09c69dd3 by Raymond Hettinger in branch 'default':
Issue #7391:  Remove outdated HOWTO with permission of its author.
http://hg.python.org/cpython/rev/e34b09c69dd3
msg130724 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2011-03-13 03:34
I discussed this with Moshe today and he agreed that the document is out-of-date and should be removed.
msg131377 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-03-19 01:22
New changeset 80ff78425419 by Raymond Hettinger in branch '3.2':
Issue 7391: Remove questionable and outdated HOWTO document with permission from its author.
http://hg.python.org/cpython/rev/80ff78425419
msg131839 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-03-23 02:24
Several people have spoken in favour of this document and you are the only one who finds it useless, apparently (*). I think it should therefore be restored in the repository.

(*) see http://mail.python.org/pipermail/python-dev/2011-March/109513.html
msg131843 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-03-23 02:36
I also remember a discussion about updating this document with items from Code Like a Pythonista, so there’s value in restoring and updating it IMO.  It’s not hopeless like the defunct Misc/cheatsheet.
msg131919 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-03-23 20:49
More links for the future update of doanddonts are under http://uthcode.sarovar.org/python.html#simple-is-better-than-complex
History
Date User Action Args
2012-06-24 11:21:09fossiletsetnosy: + fossilet
2011-03-23 20:49:08eric.araujosetmessages: + msg131919
2011-03-23 05:42:18rhettingersetassignee: rhettinger ->
nosy: moshez, georg.brandl, rhettinger, terry.reedy, orsenthil, pitrou, Horpner, ezio.melotti, eric.araujo, r.david.murray, rurpy2, python-dev
2011-03-23 02:36:20eric.araujosetnosy: moshez, georg.brandl, rhettinger, terry.reedy, orsenthil, pitrou, Horpner, ezio.melotti, eric.araujo, r.david.murray, rurpy2, python-dev
messages: + msg131843
2011-03-23 02:28:09eric.araujosetnosy: + eric.araujo
2011-03-23 02:24:14pitrousetstatus: closed -> open
versions: + Python 3.3
nosy: + pitrou, r.david.murray, orsenthil

messages: + msg131839

resolution: fixed ->
2011-03-19 01:22:43python-devsetnosy: moshez, georg.brandl, rhettinger, terry.reedy, Horpner, ezio.melotti, rurpy2, python-dev
messages: + msg131377
2011-03-13 11:22:40ezio.melottisetnosy: + ezio.melotti
2011-03-13 03:34:07rhettingersetstatus: open -> closed

nosy: + moshez
messages: + msg130724

resolution: fixed
2011-03-13 03:31:18python-devsetnosy: + python-dev
messages: + msg130722
2010-12-08 20:27:00rhettingersetassignee: docs@python -> rhettinger

messages: + msg123646
nosy: + rhettinger
2010-12-08 20:25:03terry.reedylinkissue10545 superseder
2010-12-08 20:24:39terry.reedysetnosy: + rurpy2, terry.reedy

messages: + msg123643
versions: - Python 3.0, Python 3.1
2010-10-29 10:07:21adminsetassignee: georg.brandl -> docs@python
2009-11-25 17:13:49georg.brandlsetpriority: low
resolution: wont fix -> (no value)
messages: + msg95721
2009-11-25 17:01:56Horpnersetstatus: pending -> open

messages: + msg95720
2009-11-24 22:45:33georg.brandlsetstatus: open -> pending
resolution: wont fix
messages: + msg95702
2009-11-24 14:19:22Horpnercreate