-
Book Overview & Buying
-
Table Of Contents
Python Object-Oriented Programming - Fifth Edition
By :
Throughout this book, almost all the examples have included type hints. Python added syntax for “annotations” back in Python 3.0. (See PEP 3107: https://peps.python.org/pep-3107/.) This syntax was applied to the problem of type hints starting with Python 3.6. (See PEP 526: https://peps.python.org/pep-0526/.) Since then, the idea of a formalized type system has evolved and grown.
Currently, the details are in https://typing.readthedocs.io/en/latest/spec/. This document describes the type system in detail.
The type hints are optional, and some developers feel they’re a burden because it’s slightly more code that they have to think about.
The type hints provide important clarification, and many developers feel they’re essential for describing the designer’s intention. Further, the type hints can be checked by tools, giving us helpful feedback when we’ve done something that may not work...