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: <ab5e7777a3eea74e5df9b24d8ab2ba1bed94a1a4.camel@redhat.com>
Date: Tue, 20 Jan 2026 08:45:24 +0100
From: Gabriele Monaco <gmonaco@...hat.com>
To: Wander Lairson Costa <wander@...hat.com>, Steven Rostedt
	 <rostedt@...dmis.org>, Nam Cao <namcao@...utronix.de>, open list
	 <linux-kernel@...r.kernel.org>, "open list:RUNTIME VERIFICATION (RV)"
	 <linux-trace-kernel@...r.kernel.org>
Subject: Re: [PATCH 07/26] rv/rvgen: replace __contains__() with in operator

On Mon, 2026-01-19 at 17:45 -0300, Wander Lairson Costa wrote:
> Replace the direct call to the __contains__() dunder method with the
> idiomatic in operator in the dot2c module. The previous implementation
> explicitly called the __contains__() method to check for membership in
> the final_states collection, which is not the recommended Python
> style.
> 
> Python provides the in operator as the proper way to test membership,
> which internally calls the __contains__() method. Directly calling
> dunder methods bypasses Python's abstraction layer and reduces code
> readability. Using the in operator makes the code more natural and
> familiar to Python developers while maintaining identical functionality.
> 
> Signed-off-by: Wander Lairson Costa <wander@...hat.com>

Neat, thanks!

Reviewed-by: Gabriele Monaco <gmonaco@...hat.com>

> ---
>  tools/verification/rvgen/rvgen/dot2c.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/verification/rvgen/rvgen/dot2c.py
> b/tools/verification/rvgen/rvgen/dot2c.py
> index b9a2c009a9246..c97bb9466af6d 100644
> --- a/tools/verification/rvgen/rvgen/dot2c.py
> +++ b/tools/verification/rvgen/rvgen/dot2c.py
> @@ -207,7 +207,7 @@ class Dot2c(Automata):
>              else:
>                  first = False
>  
> -            if self.final_states.__contains__(state):
> +            if state in self.final_states:
>                  line = line + '1'
>              else:
>                  line = line + '0'


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ