Python and PEP8 - Recommendations on breaking up long lines?

Steven D'Aprano steve at pearwood.info
Thu Nov 28 05:03:30 CET 2013


On Thu, 28 Nov 2013 03:57:03 +0000, Steven D'Aprano wrote:


> if True:  # add indentation, just for the example's sake.
>     if True:
>         if True:
>             with (open(self.full_path, 'r') as input,
>                       open(self.output_csv, 'ab') as output):
>                 do_this()
>                 do_that()


Bah! Apparently you can't do that.

py> with (open(self.full_path, 'r') as input,
  File "<stdin>", line 1
    with (open(self.full_path, 'r') as input,
                                     ^
SyntaxError: invalid syntax




-- 
Steven



More information about the Python-list mailing list