ID: python-best-practices/any-type-disallow

Language: Python

Severity: Warning

Category: Error Prone


Use the Any type very carefully. Most of the time, the Any type is used because we do not know exactly what type is being used. If you want to specify that a value can be of any type, use object instead of Any.

Learn More

Non-Compliant Code Examples

my_var: Any = 1
def foo(x: Any):  # do not use Any, use a specific type

Compliant Code Examples

my_var: int = 1

def my_function(a: str) -> str:
    pass jetbrains

Seamless integrations. Try Datadog Code Analysis