Understanding Python: namedtuples
HTML-код
- Опубликовано: 16 июл 2024
- In this video, we do a deep dive into named tuples.
The lesson includes the basics of named tuples, then covers unique methods, some comparisons to alternatives, touches on inheritance and then wraps up with a practical example.
As always, please comment below if you have any questions or suggestions for future videos.
Chapters
00:28 - Basics
05:00 - Methods
09:00 - Comparison
12:33 - Inheritance
17:07 - Practical Example
Video on don't he collections module: • Python Standard Librar...
Follow me on Twitter: / jakejcallahan
Source: github.com/JacobCallahan/Unde...
Intro music: 失望した by Eva
Link: • EVA - 失望した [Synthwave]...
Outro music: Elix by Synthness
Link: • Synthness - Elix ★ No ... - Наука
What are some cool uses of namedtuples that you've seen in your own, or someone else's codebase?
I like the csv example you showed!
Great video! Espessially the inheritance part! One more way to construct named tuples is to inherit from typing,NamedTuple. Similar to dataclasses this method allows to add type hints to the attributes.