-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Enhancement ✨Improvement to a componentImprovement to a componentNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementation
Milestone
Description
Bug description
z = []
res = z != []
Configuration
enable=use-implicit-booleaness-not-comparison
Command used
pylint test.py
Pylint output
test.py:2:6: C1803: "z != []" can be simplified to "z", if it is strictly a sequence, as an empty list is falsey (use-implicit-booleaness-not-comparison)
Expected behavior
While in an if statement if z != []: pass
The suggestion is right, in an assignment context I don't think it is. Changing
res = z != []
to res = z
is not the same thing
Pylint version
pylint 3.0.0
OS / Environment
No response
Additional dependencies
No response
Metadata
Metadata
Assignees
Labels
Enhancement ✨Improvement to a componentImprovement to a componentNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementation