"Unnecessary dict call" false positives
See original GitHub issueThe dict function has 3 forms: dict(**kwarg)
, dict(mapping, **kwarg)
, and dict(iterable, **kwarg)
. I’m not sure if it makes sense to apply this rule to every form.
Here’s one example use case:
def foo(data):
defaults = {'a': 1, 'b': 2}
return dict(defaults, **data)
This example could be rewritten to use literals, but it would be less succinct and (I assume, but haven’t confirmed) less performant.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:10 (5 by maintainers)
Top Results From Across the Web
flake8-comprehensions 3.1.1
Unnecessary (dict/list/tuple) call - rewrite as a literal. ... 3.1.1 (2019-11-16). Fix false positives in C416 rule for asynchronous comprehensions.
Read more >False positive Definition & Meaning
noun ; A · —a test result indicative of disease that isn't actually present—can trigger a chain reaction of worry, further tests, and...
Read more >Release highlights - Pylint 2.16.0-dev documentation - PyCQA
Fix false positive useless-type-doc on ignored argument using pylint.extensions.docparams when a function was typed using pep484 but not inside the docstring.
Read more >Python Analyzer Updates - February & March 2021
... in the existing autofixers and fixed the false positives you reported! ... PTC-W0056: Dictionary size changed during iteration.
Read more >Unnecessary anxiety definition and meaning
The chemicals in tobacco can cause a false positive test result, which could mean unnecessary anxiety and even an amniocentesis you don't really...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fix released in version 1.4.1 https://pypi.python.org/pypi/flake8-comprehensions
Looks like it is, for small dicts at least: