Re: [PATCH 1/2] gdb: fix some flake8 F824 warnings

Simon Marchi
2025-04-24T19:34:22Z

On 2025-04-24 15:28, Tom Tromey wrote:
>>>>>> "Simon" == simon marchi <simon.marchi@polymtl.ca> writes:
>
> Simon> From: Simon Marchi <simon.marchi@polymtl.ca>
> Simon> flake8 7.2.0 appears to have this new warning:
>
> Simon> F824: global name / nonlocal name is unused: name is never assigned in scope
>
> Simon> It points out a few places in our code base where "global" is not
> Simon> necessary, fix them.
>
> I'm mildly meh about this since I find "global" easier to follow, but at
> the same time I'm sure we use this style in some spots already anyway.

Yeah, since Python doesn't require it, it means we'll have some spots
that use it and some that don't. To make it clear a variable is global,
I would suggest adopting a naming standard that makes it obvious.
Global variables are often prefixed with `_`, which is a good indication
already.

Simon