[Buildroot] [PATCH 12/14] size-stats-compare: fix code style

Thomas De Schampheleire thomas.de_schampheleire at nokia.com
Tue Feb 13 20:53:09 UTC 2018


On Tue, Feb 13, 2018 at 08:51:34AM +0100, Thomas Petazzoni wrote:
> Hello,
> 
> On Tue, 13 Feb 2018 01:28:31 -0200, Ricardo Martincoski wrote:
> 
> > ... This is present in other scripts and I missed that in v1. I plan to use it
> > if you don't oppose to.
> > 
> >     if header[0] != 'File name' or header[1] != 'Package name' or \
> >        header[2] != 'File size' or header[3] != 'Package size':
> >         print(("Input file %s does not contain the expected header. Are you "
> 
> This version looks good to me. The parenthesis around the if condition
> are useless in Python.

That is not completely accurate: the parentheses are not needed for the if, they
are an alternative to providing a line-continuation character. I.e.

    if (expression1 or
        expression2):

is equivalent to:

    if expression1 or \
       expression2:

Some people/groups prefer to avoid line continuation characters by using the
parentheses style.

/Thomas



More information about the buildroot mailing list