Generics are a slightly odd (at first) but incredibly useful part of Python's type system that allow you to create a single typed interface, then provide specific types as and when you need to. They also give square brackets a good workout!
00:00 - Intro
00:44 - TypeVar primer [1]
03:35 - Illustrative example [2-3]
08:37 - Inferencing generic types using overloads [4-5]
16:30 - Outro
[1] https://docs.python.org/3/library/typ...
[2] https://docs.python.org/3/library/typ...
[3] https://github.com/Carberra/python-is...
[4] • Are descriptors the most MISUNDERSTOO...
[5] https://docs.python.org/3/library/typ...
—
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