»Data Classes in Python: Why They're Great + Examples Using attrs and dataclasses«
2019-06-03, 14:30–14:55, Main Hall
Data classes are very useful, but not often used in Python. This talk will discuss how using data classes in Python improves code readability, usability and robustness, and show how to create them easily with the attrs and dataclasses libraries.
A major reason for not using data classes is that writing them introduces quite a bit of boilerplate code, which is cumbersome and often considered "unpythonic". Lately, the attrs library has gained popularity as a good way to write data classes with very little boilerplate. Doing so gives additional benefits, such as easily adding validations and user-friendly textual representations.
In the most recent release of Python, version 3.7, a new dataclasses library was added to the standard library. Inspired by attrs, it makes using data classes in Python easier than ever, without even the cost of an added dependency.
After this talk, participants will have a good idea of when data classes should be used, and have all of the knowledge and understanding needed to implement them well.