~/talk

Type Annotations in Python: Terribly Intimidating or Tremendously Informative?

Talkat PyOhio 2021 · on Saturday, 2021-07-31· [python]
slides:none on file

Introduces concrete examples: extract_urls is annotated as Pandas.DataFrame -> List[str] so callers and tools know it returns strings, Typer uses annotations to generate CLI help and convert args to pathlib.Path, and a real bug in WorkKnow is caught by results_files vs results_file bug when Pyright reports passing a list of strings to write expecting a string/Path. Shows Mypy/Pyright and editor servers catching type mismatches and explains the small syntactic costs versus faster fail‑fast bug discovery.

AI-written summary · about

  1. 0:00Start
  2. 4:51Wait, isn't this more complicated?
  3. 7:21Easy command-line interface with Typer
  4. 8:07Command-Line Interface with Typer import typer cli = typer. Typer()
  5. 9:54Defect Detection with Pyright def create_results_zip_file
  6. 10:33Pyright Feedback in VS Code Argument of type "List[str]" cannot be assigned to parameter "filename" of type "StrPath" in function "write"
  7. 11:32Type Annotations in Python Yes, they are Tremendously Informative! Try them!
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.