Skip to content

pythoninside/europython2019

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Keep Those Ducks in (Type) Check!

How I Learned to Stop Worrying and Love the Type Checker

Francesco Pierfederici (Python Inside)

PEP 484 (building upon PEP 3107) introduced support for type hints. Type hints allow, among other things, third-party tools to check Python code for possible bugs due to unintentional type mismatches. They also serve as documentation for your functions and methods.

Understandably - or maybe surprisingly - there has been a growing interest in type hints within the Python community, especially in the last few year; even though, outside large code bases, type hints are still not that widely used.

At the same time and for many years, as Python programmers, we are used to "duct typing": focusing more on object functionality and interfaces than on their types.

Are these two approaches completely at odds with each other?

This extremely practical tutorial will teach you what type hints are and how you use them in your own code. We will focus on realistic examples and see how type hints can co-exist with Python dynamism and duck-typing. We will explore the ways in which type hints can make your code better and in some cases faster.

We will use Python 3.8 and strongly recommend that attendees install a reasonably recent version of Python 3 to make the most out of the training.

Source code available on GitHub

About

Keep Those Ducks in (Type) Check!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages