Skip to content

PEP 484

PEP 484 -- Type Hints.

예외처리

  • # type: ignore comment
  • @no_type_check decorator on a class or function
  • Custom class or Function decorator marked with @no_type_check_decorator

Stub Files

Stub files are files containing type hints that are only for use by the type checker, not at runtime. There are several use cases for stub files:

  • Extension modules
  • Third-party modules whose authors have not yet added type hints
  • Standard library modules for which type hints have not yet been written
  • Modules that must be compatible with Python 2 and 3
  • Modules that use annotations for other purposes

만드는 방법

간단히, mypy가 설치되어 있다면,

mkdir out
stubgen -m cv2 -o out

자세한 내용은 mypy:stubgen항목 참조.

그 밖의 라이브러리는 다음과 같다:

이 내용은 대표적으로, PyCharm에서 cv2심볼을 찾을 수 없는 경우 사용된다.

See also

Favorite site