[openstack-dev] [style] () vs \ continuations
sean at dague.net
Thu Nov 14 00:59:51 UTC 2013
On 11/13/2013 07:46 PM, Robert Collins wrote:
> 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
> significantly clearer.
> 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 \.
> from https://review.openstack.org/#/c/48544/15/nova/virt/vmwareapi/vmops.py
This is an area where we actually have consensus in our docs (have had
for a while), the reviewer was being consistent with them, and it feels
like you are reopening that for personal preference.
Honestly I find \ at the end of a line ugly as sin, and completely
jarring to read. I actually do like the second one better. I don't care
enough to change a policy on it, but we do already have a policy, so it
seems pretty pedantic, and not useful.
Bringing up for debate the style guide every time it disagrees with your
personal preference isn't a very effective use of people's time.
Especially on settled matters.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 482 bytes
Desc: OpenPGP digital signature
More information about the OpenStack-dev