© Kristian Rother 2017

Kristian Rother, Pro Python Best Practices, 10.1007/978-1-4842-2241-6_16

16. Static Typing in Python

Kristian Rother

(1)Berlin, Germany

Things as certain as death and taxes, can be more firmly believed.

—Daniel Defoe, The Political History of the Devil

Dynamic typing is one of the most praised features of Python. Praised because it allows for rapid development. But dynamic typing also has a dark side. Dynamic typing also means that there is no certainty of receiving a certain type of object—anywhere in the program. In this chapter we will examine why dynamic typing is a risk and how this risk can be mitigated. As an example let us consider that we want to add a high score list to our game. A simple high score list contains ...

Get Pro Python Best Practices: Debugging, Testing and Maintenance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.