diff options
| author | Wander Lairson Costa <wander@redhat.com> | 2026-02-23 13:17:47 -0300 |
|---|---|---|
| committer | Gabriele Monaco <gmonaco@redhat.com> | 2026-03-31 16:47:51 +0200 |
| commit | b70bc5cca0e8873504cf3764f281b2d9094f9653 (patch) | |
| tree | 516c43c23ecbaebbad7a8b7fc37edf35a6890402 /rust/kernel/interop/git@git.tavy.me:linux-stable.git | |
| parent | 908f377f4a0fa4b0b86352af9cb858e6ffcc6e2d (diff) | |
rv/rvgen: replace __len__() calls with len()
Replace all direct calls to the __len__() dunder method with the
idiomatic len() built-in function across the rvgen codebase. This
change eliminates a Python anti-pattern where dunder methods are
called directly instead of using their corresponding built-in
functions.
The changes affect nine instances across two files. In automata.py,
the empty string check is further improved by using truthiness
testing instead of explicit length comparison. In dot2c.py, all
length checks in the get_minimun_type, __get_max_strlen_of_states,
and get_aut_init_function methods now use the standard len()
function. Additionally, spacing around keyword arguments has been
corrected to follow PEP 8 guidelines.
Direct calls to dunder methods like __len__() are discouraged in
Python because they bypass the language's abstraction layer and
reduce code readability. Using len() provides the same functionality
while adhering to Python community standards and making the code more
familiar to Python developers.
Signed-off-by: Wander Lairson Costa <wander@redhat.com>
Reviewed-by: Gabriele Monaco <gmonaco@redhat.com>
Reviewed-by: Nam Cao <namcao@linutronix.de>
Link: https://lore.kernel.org/r/20260223162407.147003-5-wander@redhat.com
Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
Diffstat (limited to 'rust/kernel/interop/git@git.tavy.me:linux-stable.git')
0 files changed, 0 insertions, 0 deletions
