September 2026
1051 pages
35h 4m
English
In the previous section, we looked at annotations as a syntax that allows the developer to add additional information to the definition of functions, methods, variables, and attributes. Basically, this additional information can be any Python expression, but in practice we usually restrict ourselves to type information—known as type hints. These annotations can be read by external utilities that support the programmer on this basis—for example, with context help.
So far, we’ve looked at annotations with simple data types such as int or str and used these examples to clarify the basic syntactic form of an annotation. In this section, we’ll take advantage of the fact that type hints can also be more complex ...
Read now
Unlock full access