You NEED to know about Python protocols

Опубликовано: 06 June 2026
на канале: Carberra
6,267
203

Protocols are perfect for attribute and method checking, and really shine in situations where you need a lazy check to ensure an object has everything it needs to work properly. In this video, we'll learn how to create our own!

0:00 - Intro
0:49 - Creating basic protocols [1]
3:14 - Runtime-checkable protocols [1]
4:51 - Creating a `Sendable` protocol
5:48 - Protocols with arbitrary parameters [2-3]
8:01 - Bypassing import restrictions with protocols
9:46 - Outro

[1] https://docs.python.org/3/library/asy...
[2] https://github.com/microsoft/pyright/...
[3] https://github.com/python/mypy/issues...

—

If you want to see more of me, join my Discord server!
  / discord  

I get a lot of people asking, so here's my setup!
• Visual Studio Code:    • My Visual Studio Code setup! (2024)  
• Terminal:    • Make your terminal look AMAZING  
• Desk/recording gear: https://kit.co/Carberra
• PC build: https://uk.pcpartpicker.com/list/TmzGYN

Affiliations (I may earn a commission):
• Codecrafters -- 40% off any plan: https://app.codecrafters.io/join?via=...
• Keeper Password Manager -- 30% off your first year: https://keeper.io/r/EX4FB1C

—

If you have any questions, don't hesitate to ask in the comments! I'll try and answer as soon as I can, providing someone else hasn't already done so.

#python #coding #howto