~/talk

Getting Started with Statically Typed Programming in Python 3.10

Talkat PyCon US 2022 · 2022-04-27..05-03· [python, typescript]
name:Peacock
links:none on file
slides:none on file

Practical primer that shows actual code and compatibility moves: annotation syntax for arguments and returns, concrete examples of lists, tuples, Mapping and Collection. Demonstrates X | Y union syntax, ParameterSpec usage, explicit TypeAlias and TypeGuard patterns, and user‑defined generics plus how typing_extensions backfills features on older Pythons. Shows editor completion and type narrowing working with a type checker, gives step‑by‑step migration tips, and notes 3.11’s Self support and where runtime behavior or performance matters.

AI-written summary · about

  1. 0:00Getting Started with Statically Typed Programming in Python 3.10
  2. 7:41Let's start with function definitions Nothing too difficult Just write type . After the arguments, write colon and the type . Before the colon at the end of the function definition write an arrow and the type
  3. 8:36Escaping from complex type puzzles • Any can hold instances of any type • It's better not to use it • Import and use from typing when necessary
  4. 10:26Using types from collections.abc differently • There are many types in collections.abe" . It's better to use a collection with a few methods to increase portability • Ex. 'Iterable is better than "list • It's a good idea to look at the methods used in your functions The figure on the next page shows the relationship...
  5. 12:41The differences between tuple and other Sequences • tuple' is fixed up to the length of information • Specify the type for the number of elements . Or you can mix types, such as tuple int
  6. 13:20A sequence, such as a list has the same constraint for all elements . Can be used regardless of the length of the Sequence by setting only one
  7. 17:37User-defined Generic types Example: a generic mapping type
  8. 18:42What is the future. module? . Using typing new feature in the older versions, write
  9. 20:10New Features on Type Hints in 3.10 • PEP 504: New Type Union Operator • PEP 512 Parameter Specification Variables
  10. 21:00PEP 612: Parameter Specification Variables Motivation Needed a way to represent a function that has the same arguments as the specified function
  11. 23:48PEP 647: User-Defined Type Guards Motivation • Type checker tools use a technique called type narrowing to determine the type of information
  12. 25:16New Feature on Type Hints in 3.11 Python 3.11 is focused on performance tuning but there are also new features in Typing
  13. 27:11Summary 1. Benefits, starting with def , Built-in types 2. Standard collections since 39 3. Collections, Union, Optional Callable. User-defined Generics
~/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.