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

Matt Riedemann mriedem at linux.vnet.ibm.com
Thu Dec 22 23:52:25 UTC 2016

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:unsubscribe
> 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 recently 
simply for the exact reason I think people used to -1 it, because it was 
considered ugly to use. But we've also had cases of () gone haywire. I 
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 take 
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 wouldn't 
-1 for using \ as a rule.



Matt Riedemann

More information about the OpenStack-dev mailing list