MemotivaType hints and typing

How do you declare types in modern Python?

Type hints and typing

Audio flashcard · 0:14

Nortren·

How do you declare types in modern Python?

0:14

Use the colon syntax for variables and parameters, and the arrow syntax for return types. Built-in generic types like list, dict, and tuple support subscript notation directly since Python 3.9, so you can write list of int instead of importing List from typing.
peps.python.org