False positive unnecessary-comprehension
when modifying a dict to a list of tuples
#4499
Labels
Documentation 📗
Good first issue
Friendly and approachable by new contributors
Help wanted 🙏
Outside help would be appreciated, good for new contributors
Milestone
Steps to reproduce
Given a file
a.py
:Pylint will complain about an unnecessary comprehension, even though the comprehension is modifying the type from a dictionary to a list of tuples.
Current behavior
Result of
pylint a.py
:Expected behavior
No errors.
pylint --version output
Result of
pylint --version
output:EDIT: I guess alternatively it might be cleaner to use
list(mydict.items())
instead. That feels like it might be a separate issue altogether, and I'm not sure if there aren't other false positives that can't be solved similarly. It's not that the comprehension is unnecessary, it's that there's a nicer way to do it. Maybe a new warning might also be a good idea?The text was updated successfully, but these errors were encountered: