Re: [PATCH net-next 2/6] tools: ynl-gen: refactor render-max enum generation

From: Jakub Kicinski

Date: Tue Oct 14 2025 - 15:26:03 EST


On Tue, 14 Oct 2025 17:04:14 +0000 Asbjørn Sloth Tønnesen wrote:
> On 10/14/25 12:58 AM, Jakub Kicinski wrote:
> > On Mon, 13 Oct 2025 16:49:59 +0000 Asbjørn Sloth Tønnesen wrote:
> >> + suffix = yaml['type'] == 'flags' and 'mask' or 'max'
> >
> > This construct looks highly non-pythonic to me
>
> I don't mind changing it to it's multi-line form, but this line might go
> away (see below).
>
> >> + self.enum_max_name = f'{self.value_pfx}{suffix}'
> >
> > sometimes its max sometimes is mask, so we shouldn't call it max always
>
> I'm fine with splitting them to render-max, enum-max-name, render-mask and
> enum-mask-name. I was just following along the current lines in the code,
> as started in commit 96a611b6b60c.

Ideally we'd find a general noun to describe both max and mask..
I don't have any great suggestions tho