Data classes are a valuable tool in the Python programmer's toolkit. Despite their usefulness (I do like them a lot!), they do have limitations. In this video, I compare dataclasses with two alternative options, attrs and Pydantic, to help you decide which one to use in your code.
GitHub repository here: https://github.com/ArjanCodes/2023-attrs
???? Next-Level Python Skillshare Class: https://skl.sh/3ZQkUEN
???? Get my FREE 7-step guide to help you consistently design great software: https://arjancodes.com/designguide.
???? GEAR & RECOMMENDED BOOKS: https://kit.co/arjancodes.
???? Sign up to Brilliant now and get 20% off the annual subscription: https://brilliant.sjv.io/arjancodes.
???? If you enjoyed this content, give this video a like. If you want to watch more of my upcoming videos, consider subscribing to my channel!
???? Discord: https://discord.arjan.codes
????Twitter: https://twitter.com/arjancodes
????LinkedIn: https://www.linkedin.com/company/arjancodes
????Facebook: https://www.facebook.com/arjancodes
????Instagram: https://www.instagram.com/arjancodes
???? Code reviewers:
- Yoriz
- Ryan Laursen
- James Dooley
- Dale Hagglund
???? Video edited by Mark Bacskai: https://www.instagram.com/bacskaimark
???? Code example by Henrique Branco: https://www.linkedin.com/in/henriqueajnb
???? Chapters:
0:00 Intro
1:34 Example explanation
4:20 Comparison
7:07 Attribute validation
11:26 Pros and cons dataclasses
13:00 Pros and cons attrs
14:14 Pros and cons Pydantic
15:58 Final thoughts
16:42 Outro
#arjancodes #softwaredesign #python
DISCLAIMER - The links in this description might be affiliate links. If you purchase a product or service through one of those links, I may receive a small commission. There is no additional charge to you. Thanks for supporting my channel so I can continue to provide you with free content each week!