python type hints
TRANSCRIPT
TYPESint # integer objects of arbitrary sizefloat # floating point numberbool # boolean valuestr # unicode stringbytes # 8-bit stringobject # the common base classList[str] # list of str objectsDict[str, int] # dictionary from str to intIterable[int] # iterable object containing intsSequence[bool] # sequence of booleans
Any # dynamically typed valueUnion[str, bytes] # set of expected types for a single argumentCallable # lambda and functions objectsAnyStr # equivalent to TypeVar('AnyStr', str, bytes)
e mais…
IGNORING TYPE CHECKER
@no_type_check decorator on classes and functions
a # type: ignore comment on arbitrary lines
REFERÊNCIAS
• http://mypy-lang.org/
• http://sdtimes.com/python-3-5-include-type-hinting/
• https://www.youtube.com/watch?v=2wDvzy6Hgxg