Rock Solid Python with Python Typing Transcripts
Chapter: Course Conclusion
Lecture: Conclusion
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
You made it to the end. That's it. I hope you really enjoyed this course.
0:07
I know there's a ton of cool stuff that I'm sure you've learned because I learned a lot of it as well while creating this course on Python types.
0:16
Let's just do a quick look back, a quick review at what we've discussed throughout this course and kind of keep it fresh in your mind one more time.
0:25
We started out by talking about the whole spectrum of type systems and type safe or unsafe languages.
0:32
On one hand, we had the really type strict ones like C# and Swift. And the other we had JavaScript and Python. We've seen the initiatives.
0:40
This course is conversation around Python type hints and TypeScript to push that stuff, Python and JavaScript way more to the right.
0:48
So we saw you can dial this in the Python world. You cannot in TypeScript so much.
0:54
But in Python, you can choose how much typing you want and how much you want to just kind of freeform it in a dynamic style.
1:02
Python types came from PEP 484 originally introduced way back in when in September 2014.
1:10
And they appeared in Python 3.5, which is actually, it was an amazing version. It's not even supported anymore. That's where async and await came from.
1:20
That's where Python types came from. That's one of the most important releases of Python, in my opinion.
1:26
If you want to have types that are not part of a package or not in the code, we saw that
1:31
typeshed has this support for many external packages that are out there that maybe can't be changed to have types for some reason.
1:39
You could also do this at your company, this idea of these type definition files. We also talked about awesome frameworks built on types.
1:51
In fact, we started that conversation off by talking about awesome Python typing, which
1:56
is a collection of awesome Python types, subs, plugins, and tools to work with Python types.
2:01
You can check that out and there's many more places to find that.
2:04
But we covered Pydantic, which is like kind of data classes plus data validation, data conversion, really, really popular and important.
2:13
FastAPI built on Pydantic. Django Ninja built on Pydantic. Genie from MongoDB built on Pydantic.
2:21
We also spent some time talking about editors explicitly, even though you've seen one example of it throughout this whole course.
2:29
VS Code and PyCharm, super, super valuable to have them understanding the type information
2:36
and surfacing that to us and providing warnings where we get it wrong.
2:40
We can also run mypy, which is great for continuous integration or for Git pre-commit hooks, that
2:47
type of stuff where you're not necessarily even looking at the code, but it'll run against a code base and give you basically the same errors.
2:54
And if you want true runtime checking, think about bare type, you can actually put that
3:00
on maybe the boundary of your code and say, we're not just going to suggest that the type
3:04
line up, we're going to make sure it absolutely does with runtime type checking.
3:09
We closed out our syntax conversation about like, how do you express stuff in Python and types by talking about something pretty unique, protocol.
3:18
So we said, look how messed up this object hierarchy becomes when we're using straight inheritance.
3:25
But if we use this drivable protocol, all of a sudden we can have little tiny object
3:31
inheritance sections if we want, but long as they all conform to this protocol, then we can use them all the same and still express this drivable type.
3:42
That's really unique with protocol, unlike say, interfaces and other languages, motorcycle,
3:48
automobile, car and robot, none of them have to derive from drivable, just long as their
3:53
structure matches, Python will figure that out through the protocol. Really love this.
3:58
Finally, we talked about patterns and all the different ways you want to think about it.
4:05
We talked about minimalism and say, things like iterable instead of list.
4:10
We talked about using optional of thing versus say, thing, pipe, none, the multiple paths
4:17
you might choose based on what version of Python you're targeting, no return, a lot of fun stuff over there. So stay in touch.
4:26
Thank you for taking the class. You can find my essays and links to basically every social media and stuff that I have over at mkennedy.codes.
4:36
Come to the Talk Python to Me podcast where I interview many of the creators of many of
4:41
the things we've talked about, some of the peps, some of the frameworks, all that over
4:45
on Talk Python to Me, the Python Bytes podcast where we talk about awesome libraries and tools we find every week.
4:52
And find me over on Mastodon where I'm@mkennedy@fosdodon.org. And if you X, you can just find me@mkennedy over there.
5:01
Thanks so much for taking this course. Awesome. You made it to the end. See you around.