-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Labels
Bug 🪲False Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the codeGood first issueFriendly and approachable by new contributorsFriendly and approachable by new contributors
Milestone
Description
Bug description
I have a function that accepts a lambda as follows:
zigzag(
encoded_message,
num_rails,
lambda i, _: rail_lengths.__setitem__(i, rail_lengths[i] + 1)
)
pylint generates an error:
C2801: Unnecessarily calls dunder method __setitem__. Set item via subscript. (unnecessary-dunder-call)
But assignment isn’t valid in a lambda, so, the suggestion is incorrect.
Configuration
No response
Command used
pylint \
--score n \
--ignore-paths '^.*_test.py$' \
--disable C0103,C0104,C0114,C0115,C0116 \
"$basedir"/**/*.py
Pylint output
C2801: Unnecessarily calls dunder method __setitem__. Set item via subscript. (unnecessary-dunder-call)
Expected behavior
No error.
Pylint version
pylint 2.17.4
Python 3.11.3
OS / Environment
No response
Additional dependencies
No response
Metadata
Metadata
Assignees
Labels
Bug 🪲False Positive 🦟A message is emitted but nothing is wrong with the codeA message is emitted but nothing is wrong with the codeGood first issueFriendly and approachable by new contributorsFriendly and approachable by new contributors