Wander Lairson Costa <[email protected]> writes: > 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 <[email protected]>
Reviewed-by: Nam Cao <[email protected]>
