-
-
Notifications
You must be signed in to change notification settings - Fork 26.2k
Closed
Labels
Description
Describe the bug
Only found one instance but should be worth improving since is in tutorial sections.
Calling the not or ~ prefix operator twice might be redundant: the second invocation undoes the first. Such mistakes are typically caused by accidentally double-tapping the key in question without noticing. Either this is a bug, if the operator was actually meant to be called once, or misleading if done on purpose. Calling not twice is commonly done instead of using the dedicated "bool()" builtin function. However, the latter one increases the code readability and should be used.
Steps/Code to Reproduce
a = 0
b = False
c = not not a # Noncompliant
d = ~~b # Noncompliant
Expected Results
Same functional result, true/false but improve readability.
Actual Results
Syntax and readability issue.
Versions
OS Windows 10, Python 3.8 Pandas 1.5.0