Message95676
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. |
|
Date |
User |
Action |
Args |
2009-11-24 14:19:23 | Horpner | set | recipients:
+ Horpner, georg.brandl |
2009-11-24 14:19:23 | Horpner | set | messageid: <1259072363.61.0.346322429524.issue7391@psf.upfronthosting.co.za> |
2009-11-24 14:19:22 | Horpner | link | issue7391 messages |
2009-11-24 14:19:21 | Horpner | create | |
|