builtin-attribute-shadowing (A003)#
Derived from the flake8-builtins linter.
What it does#
Checks for any class attributes or methods that use the same name as a builtin.
Why is this bad?#
Reusing a builtin name for the name of an attribute increases the difficulty of reading and maintaining the code, and can cause non-obvious errors, as readers may mistake the attribute for the builtin and vice versa.
Builtins can be marked as exceptions to this rule via the
flake8-builtins.builtins-ignorelist
configuration option, or
converted to the appropriate dunder method. Methods decorated with
@typing.override
or @typing_extensions.override
are also
ignored.
Example#
Use instead:
Or: