이 제품은 선택한 Datadog 사이트에서 지원되지 않습니다. ().
이 페이지는 아직 한국어로 제공되지 않습니다. 번역 작업 중입니다.
현재 번역 프로젝트에 대한 질문이나 피드백이 있으신 경우 언제든지 연락주시기 바랍니다.

Metadata

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

Language: Python

Severity: Warning

Category: Error Prone

Description

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
   pass

Compliant Code Examples

my_var: int = 1

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

def my_function2(**kwds: Any) -> str:
    pass

def my_function2(*_: Any) -> str:
    pass

def my_function2(*args: Any) -> str:
    pass

def my_function3(**_: Any) -> str:
    pass
https://static.datadoghq.com/static/images/logos/github_avatar.svg https://static.datadoghq.com/static/images/logos/vscode_avatar.svg jetbrains

원활한 통합. Datadog Code Security를 경험해 보세요