Rock Solid Python with Python Typing Transcripts
Chapter: Typing in Python
Lecture: Where Do Python Type Hints Come From?

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Let's go way, way back to 2015. Here you can see the PEP for Python type hints.
0:09 Sometimes they're called Python type annotations, but you can see officially they were introduced as type hints, and that's PEP 484. This was
0:17 originally submitted by Guido van Rossum, as well as a couple of other folks here, supported by Mark Shannon, and it was introduced in Python
0:25 3.5. So that's when I was... that's how I'm... how come I'm talking
0:29 about, you know, if you're using 3.5 or above, then these things apply to you. All right,
0:34 really quickly, we just scroll down to the motivation. So this PEP is a little more comprehensive.
0:41 And it aims to add standard syntax for typing annotations. Now using the alternate phrasing
0:46 here, opening up Python to easier static analysis and refactoring. Interestingly, they already call
0:52 out potential runtime type checking, we will talk about that later in the class. And some of the
0:58 the time, possible code generation utilizing this type information. So this is the definitive
1:05 source of where Python type hints come from and the motivation you can look through. It's quite a long PEP as you can see from the scroll bar there.


Talk Python's Mastodon Michael Kennedy's Mastodon