RECURSE CENTER ‘LOCALHOST’ TALK

MYPY (ALISON KAPTUR)

"""

install: `pip install mypy`
use: `mypy <ur_script>.py`
docs: https://mypy.readthedocs.io/en/stable/getting_started.html#installing-mypy

* looks at AST, doesn't run src
* write a bit more code, read a lot less
* more code and simpler code (vs. Java tower of abstractions in type graph)
* prevents drift btw method sig and impl (esp. after refactor)
* seems easier/better to use at the start of a project (although, gradual typing given as a main use case; tbh, idk)
* similarties w/ unit testing: don't need 100% type coverage, similar edge cases

"""

def greeting(name: str) -> str:
    return 'hello, {}'.format(name)

# pass wrong type
greeting(b'alice')

def p() -> None:
    print('hello')

# attempt to return None type
a = p()