~/talk

Elastic Generics: Flexible Static Typing with TypeVarTuple and Unpack

Talkat PyCon US 2025 · 2025-05-16..05-18· [typescript]
links:none on file
slides:none on file

TypeVarTuple and Unpack make generics variadic so a class can be parameterized as Record[int, str], Record[int, str, float], or Record[int, str, tuple[float, ...]] and mypy statically validates those shapes. Python 3.11 adds the TypeVarTuple primitive and 3.12 simplifies declaration syntax. StaticFrame ships a comprehensively generic DataFrame that models a fixed heterogenous prefix and a variable uniform suffix, offers a runtime checker and relies on mypy validation*. Limitation: only one unpack region per generic.

AI-written summary · about

  1. 0:00Elastic generics intro
  2. 1:49Elemental and generic types
  3. 4:42Traditional generics limits
  4. 6:49TypeVarTuple and Unpack
  5. 9:17Flexibility of tpple
  6. 11:07Advanced tpple use cases
  7. 14:39Defining generics with TypeVarTuple
  8. 18:34TypeVar and TypeVarTuple
  9. 20:00Generic data frames
  10. 26:01Why elastic generics matter
  11. 27:22Q&A
~/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.