-
-
Notifications
You must be signed in to change notification settings - Fork 410
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
What's wrong
WPS421 forbids calling some built-in functions, which includes hasattr()
.
How it should be
The function hasattr()
should be allowed. There are certain scenarios where using hasattr()
makes sense, and sometimes is even faster (as even outlined in the referenced video @ 13:34-14:15 mark)
For code readability, if hasattr(foo, 'bar'):
is cleaner than if getattr(foo, 'bar', None):
.
I believe there was an argument against using hasattr()
in python2, but I don't believe the same argument is valid for python3.
Flake8 version and plugins
n/a
pip information
n/a
OS information
n/a
cz-kialo and FedorovP777
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working