-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
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
Description
Steps to reproduce
reproducer.py:
"""false positive: bad-reversed-sequence"""
x = {'hello': 'world'}
for key in reversed(x):
print(key)> pylint reproducer.py
************* Module reproducer
reproducer.py:3:11: E0111: The first reversed() argument is not a sequence (bad-reversed-sequence)
Current behavior
Using a dictionary with reversed() causes a bad-reversed-sequence error to be emitted.
Expected behavior
This is fine in Python 3.7 and up, where dictionaries have a known order. Though they are not Sequence types as such, they do implement the __reversed__ method.
pylint --version output
pylint 2.6.0
astroid 2.4.2
Python 3.8.6 (default, Sep 25 2020, 00:00:00)
[GCC 10.2.1 20200723 (Red Hat 10.2.1-1)]
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