[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CO1PR11MB5089214A5CF1D53B4B54CC00D6BD2@CO1PR11MB5089.namprd11.prod.outlook.com>
Date: Wed, 16 Apr 2025 16:20:00 +0000
From: "Keller, Jacob E" <jacob.e.keller@...el.com>
To: Jakub Kicinski <kuba@...nel.org>, Donald Hunter <donald.hunter@...il.com>
CC: "davem@...emloft.net" <davem@...emloft.net>, "netdev@...r.kernel.org"
<netdev@...r.kernel.org>, "Dumazet, Eric" <edumazet@...gle.com>,
"pabeni@...hat.com" <pabeni@...hat.com>, "andrew+netdev@...n.ch"
<andrew+netdev@...n.ch>, "horms@...nel.org" <horms@...nel.org>,
"daniel@...earbox.net" <daniel@...earbox.net>, "sdf@...ichev.me"
<sdf@...ichev.me>
Subject: RE: [PATCH net 1/8] tools: ynl-gen: don't declare loop iterator in
place
> -----Original Message-----
> From: Jakub Kicinski <kuba@...nel.org>
> Sent: Wednesday, April 16, 2025 6:45 AM
> To: Donald Hunter <donald.hunter@...il.com>
> Cc: davem@...emloft.net; netdev@...r.kernel.org; Dumazet, Eric
> <edumazet@...gle.com>; pabeni@...hat.com; andrew+netdev@...n.ch;
> horms@...nel.org; daniel@...earbox.net; sdf@...ichev.me; Keller, Jacob E
> <jacob.e.keller@...el.com>
> Subject: Re: [PATCH net 1/8] tools: ynl-gen: don't declare loop iterator in place
>
> On Wed, 16 Apr 2025 11:06:39 +0100 Donald Hunter wrote:
> > > def put_req_nested(ri, struct):
> > > + local_vars = []
> > > + init_lines = []
> > > +
> > > + local_vars.append('struct nlattr *nest;')
> > > + init_lines.append("nest = ynl_attr_nest_start(nlh, attr_type);")
> >
> > Minor nit: the series uses += ['...'] elsewhere, is it worth being
> > consistent?
>
> Agreed, it was annoying me too.. but in _multi_parse() I seem to have
> used .append() in the exact same scenario. Hard to define "consistent"
> in this code base :(
+= [ ... ] is more akin to joining two lists, which may technically be less efficient if you're just adding a single element. Of course that probably doesn't matter for something like this.
I'd say its fairly clear either way so not sure how much we gain from consistency vs re-rolling.
Thanks,
Jake
Powered by blists - more mailing lists