[openstack-dev] [style] () vs \ continuations
robertc at robertcollins.net
Thu Nov 14 00:46:35 UTC 2013
Hi so - in http://docs.openstack.org/developer/hacking/
it has as bullet point 4:
Long lines should be wrapped in parentheses in preference to using a
backslash for line continuation.
I'm seeing in some reviews a request for () over \ even when \ is
I'd like us to avoid meaningless reviewer churn here: can we either:
- go with PEP8 which also prefers () but allows \ when it is better
- and reviewers need to exercise judgement when asking for one or other
- make it a hard requirement that flake8 detects
My strong recommendation is to go with PEP8 and exercising of judgement.
The case that made me raise this is this:
folder_exists, file_exists, file_size_in_kb, disk_extents = \
self._path_file_exists(ds_browser, folder_path, file_name)
Wrapping that in brackets gets this;
folder_exists, file_exists, file_size_in_kb, disk_extents = (
self._path_file_exists(ds_browser, folder_path, file_name))
Which is IMO harder to read - double brackets, but no function call,
and no tuple: it's more ambiguous than \.
Robert Collins <rbtcollins at hp.com>
HP Converged Cloud
More information about the OpenStack-dev