C408: Unnecessary <dict/list/tuple> call - rewrite as a literal.
It's slower to call e.g. dict() than using the empty literal, because the name dict must be looked up in the global scope in case it has been rebound. Same for the other two basic types here. For example:
Rewrite dict() as {}
Rewrite dict(a=1, b=2) as {"a": 1, "b": 2}
Rewrite list() as []
Rewrite tuple() as ()
Are you really proposing to represent tuple as (), but for Python it is not right because the comma is an tuple indicator foo, bar this is a tuple or singular one something, and adding parenthesis only adds readability, but it is not syntactically required: (foo, bar) and (something,).
Python Version
No response
flake8 Version
No response
Package Version
No response
Description
Are you really proposing to represent tuple as
()
, but for Python it is not right because the comma is an tuple indicatorfoo, bar
this is a tuple or singular onesomething,
and adding parenthesis only adds readability, but it is not syntactically required:(foo, bar)
and(something,)
.