Get rid of boilerplate in writing classes.
Which dataclass alternative should you use though? In this video we test dataclasses, attrs, tuple, namedtuple, NamedTuple, dict, SimpleNamespace, and Pydantic BaseModel for speed, memory efficiency, and features.
― mCoding with James Murphy (https://mcoding.io)
Source code: https://github.com/mCodingLLC/VideosS...
Previous dataclasses video: • Python dataclasses will save you HOUR...
dataclasses: https://docs.python.org/3/library/dat...
attrs: https://www.attrs.org/en/stable/examp...
namedtuple: https://docs.python.org/3/library/col...
NamedTuple: https://docs.python.org/3/library/typ...
SimpleNamespace: https://docs.python.org/3/library/typ...
Pydantic: https://pydantic-docs.helpmanual.io/u...
SUPPORT ME ⭐
---------------------------------------------------
Patreon: / mcoding
Paypal: https://www.paypal.com/donate/?hosted...
Other donations: https://mcoding.io/donate
Top patrons and donors: Jameson, Laura M, Dragos C, Vahnekie, John Martin, Casey G, Pieter G, Krisztian M, Sigmanificient
BE ACTIVE IN MY COMMUNITY 😄
---------------------------------------------------
Discord: / discord
Github: https://github.com/mCodingLLC/
Reddit: / mcoding
Facebook: / james.mcoding
CHAPTERS
---------------------------------------------------
0:00 Intro
1:04 dataclass
1:24 attrs
2:13 tuple, namedtuple, NamedTuple
4:05 dict
4:39 SimpleNamespace
4:58 Pydantic
6:39 Speed comparison
8:41 Memory comparison
9:15 Feature matrix and winners
Watch video Which Python @dataclass is best? Feat. Pydantic, NamedTuple, attrs... online without registration, duration hours minute second in high quality. This video was added by user mCoding 16 October 2021, don't forget to share it with your friends and acquaintances, it has been viewed on our site 110,232 once and liked it 4.6 thousand people.