[openstack-dev] [all] Using \ for multiline statements

Ian Cordasco sigmavirus24 at gmail.com
Tue Dec 27 22:12:11 UTC 2016

On Tue, Dec 27, 2016 at 12:00 PM, Ed Leafe <ed at leafe.com> wrote:
> On Dec 27, 2016, at 11:33 AM, Sean McGinnis <sean.mcginnis at gmx.com> wrote:
>>> There is a problem with the use of backslash at the end of the line, where
>>> if you also put a space after it, it no longer does what it seemingly
>>> should.
>> Oooh. nice. This is the good technical reason I was looking for. So there
>> really is a valid reason to avoid this, other than just preference of
>> readability and coding style. Thanks!
> True, but we also have a pep8 check for spaces at the end of lines.
> -- Ed Leafe

Worth noting, though, that if you are using multiple context managers
in a single 'with' statement that you can't use ()s to split them
across multiple lines, you *must* use \s, otherwise it is
syntactically invalid. (Weird, yes, I know. Guido has refused to make
this consistent on python-dev several times iirc.)

Ian Cordasco

More information about the OpenStack-dev mailing list