Python and PEP8 - Recommendations on breaking up long lines?
ben+python at benfinney.id.au
Thu Nov 28 04:06:50 CET 2013
Ned Batchelder <ned at nedbatchelder.com> writes:
> The important thing in a with statement is that the assigned name will
> be closed (or otherwise exited) automatically. The open call is just
> the expression used to assign the name. The expression there isn't
> really important. This looks odd, but works the same as what you
> input = open(self.full_path)
> output = open(self.output_csv, 'ab')
> with input as input, output as output:
Excellent! That solves for me a significant irritation of the syntax for
multiple context managers. Thank you.
\ “The most common way people give up their power is by thinking |
`\ they don't have any.” —Alice Walker |
More information about the Python-list