mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-28 04:45:01 +00:00
513 B
513 B
dynamically-typed-expression (ANN401)
Derived from the flake8-annotations linter.
What it does
Checks that an expression is annotated with a more specific type than Any
.
Why is this bad?
Any
is a type that can be anything, and it is the default type for
unannotated expressions. It is better to be explicit about the type of an
expression, and to use Any
only when it is really needed.
Example
def foo(x: Any):
...
Use instead:
def foo(x: int):
...