[openstack-dev] [all] Using \ for multiline statements
michal.dulko at intel.com
Fri Dec 23 09:21:18 UTC 2016
On Thu, 2016-12-22 at 17:52 -0600, Matt Riedemann wrote:
> On 12/22/2016 5:28 PM, Sean McGinnis wrote:
> > Looking for input from everyone, particularly those with more in-
> > depth
> > Python knowledge.
> > In Cinder for some time we have been trying to enforce using () or
> > reformatting code to avoid using \ to have statements span multiple
> > lines. I'm not sure when this actually started, but I think it may
> > be one of those things where someone got a review disagreement, so
> > then that person started downvoting on it, then the next person,
> > etc.
> > I've seen some allusions to the use of \ having some issues, but I
> > can't find any concrete examples where this can cause problems. I
> > do
> > seem to remember trying to write a hacking check or a code parsing
> > tool to do something that choked on these, but it's long enough ago
> > that I don't remember the details, and I could very well be mixing
> > that up with something else.
> > So my question is - is there a technical reason for enforcing this
> > rule, or is this just a bad downvote that's gotten out of control?
> > Thanks!
> > Sean
> > ___________________________________________________________________
> > _______
> > OpenStack Development Mailing List (not for usage questions)
> > Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsu
> > bscribe
> > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
> I wouldn't -1 it. I've noticed \ showing up a bit more in Nova
> simply for the exact reason I think people used to -1 it, because it
> considered ugly to use. But we've also had cases of () gone haywire.
> typically see \ used in unit tests or in DB API code when chaining
> sqlalchemy ORM objects together to generate a single query.
> Like most things like this, I'd rather than squabble over it, and
> it on a case by case basis. If a patch is hard to read and could be
> improved using one or the other, then I'd comment as such, but
> -1 for using \ as a rule.
I'm one of these people that tend to complain about use of backslash in
reviews. To be honest I've simply remembered that rule from the first
time I've read OpenStack Style Guidelines . I think if we want to be
more permissive in this matter, we should indicate it there.
More information about the OpenStack-dev