[openstack-dev] [style] () vs \ continuations
dolph.mathews at gmail.com
Thu Nov 14 14:53:33 UTC 2013
On Wed, Nov 13, 2013 at 6:46 PM, Robert Collins
<robertc at robertcollins.net>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
+1 for the non-human approach.
> 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))
The root of the problem is that it's a terribly named method with a
terrible return value... fix the underlying problem.
> 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>
> Distinguished Technologist
> HP Converged Cloud
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the OpenStack-dev