lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <m2y0o3lmrx.fsf@gmail.com>
Date: Tue, 18 Nov 2025 09:20:50 +0000
From: Donald Hunter <donald.hunter@...il.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: Gal Pressman <gal@...dia.com>,  "David S. Miller" <davem@...emloft.net>,
  Eric Dumazet <edumazet@...gle.com>,  Paolo Abeni <pabeni@...hat.com>,
  Andrew Lunn <andrew+netdev@...n.ch>,  <netdev@...r.kernel.org>,  Simon
 Horman <horms@...nel.org>,  Alexei Starovoitov <ast@...nel.org>,  Daniel
 Borkmann <daniel@...earbox.net>,  Jesper Dangaard Brouer
 <hawk@...nel.org>,  John Fastabend <john.fastabend@...il.com>,  Stanislav
 Fomichev <sdf@...ichev.me>,  <bpf@...r.kernel.org>,  Nimrod Oren
 <noren@...dia.com>
Subject: Re: [PATCH net-next 1/3] tools: ynl: cli: Add --list-attrs option
 to show operation attributes

Jakub Kicinski <kuba@...nel.org> writes:

> On Sun, 16 Nov 2025 21:28:43 +0200 Gal Pressman wrote:
>>
>> +    def print_attr_list(attr_names, attr_set):
>
> It nesting functions inside main() a common pattern for Python?
> Having a function declared in the middle of another function,
> does not seem optimal to me, but for some reason Claude loves
> to do that.

It's common for closure-like things and for scoping. Reviewing this
again, these add a lot of noise to main() and would be better separated
out.

To be fair, I started it with `def output(msg)` but I'd argue it is a
closure-like scoped helper thing :-)

>> +        """Print a list of attributes with their types and documentation."""
>> +        for attr_name in attr_names:
>> +            if attr_name in attr_set.attrs:
>> +                attr = attr_set.attrs[attr_name]
>> +                attr_info = f'  - {attr_name}: {attr.type}'
>> +                if 'enum' in attr.yaml:
>> +                    attr_info += f" (enum: {attr.yaml['enum']})"
>> +                if attr.yaml.get('doc'):
>> +                    doc_text = textwrap.indent(attr.yaml['doc'], '    ')
>> +                    attr_info += f"\n{doc_text}"
>> +                print(attr_info)
>> +            else:
>> +                print(f'  - {attr_name}')
>> +

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ