Skip to content
0:00 / 0:00

#dataclasses#pep557#attrs

Raymond Hettinger - Dataclasses: The code generator to end all code generators - PyCon 2018

PyCon 2018

22K subscribers • 3 videos on Hallway

YouTube
  • Recommended by 2 people: 2 on Hacker News.
  • Presented by Raymond Hettinger, Python Core Developer
  • Linked in the descriptionPyCon/2018-slides

Intermediate. Assumes working knowledge.

129K views8 years ago2 recommendations

Programming languagesPython

Raymond Hettinger explains the design decisions behind Python's dataclasses module and demonstrates how to use them for data aggregation.

Speaker: Raymond Hettinger The PEP 557 dataclasses module is available in starting in Python 3.7. It will become an essential part of every Python programmer's toolkit. This talk shows what problem the module solves, explains its key design decisions, and provides practical examples of how to put it to work. Dataclasses are shown to be the next step in a progression of data aggregation tools: tuple, dict, simple class, bunch recipe, named tuples, records, attrs, and then dataclasses. Each builds upon the one that came before, adding expressiveness at the expense of complexity. Dataclasses are unique in that they let you selectively turn-on or turn-off its various capabilities and it lets the user choose the underlying data store (either instance dictionary, instance slots, or an inherited base class). Dataclasses and typing.NamedTuple both use variable annotations which were new in Python 3.6. Slides can be found at: speakerdeck.com/pycon2018 and github.com/PyCon/2018-slides

Why it's here

2 people recommend this

What people say. Recommended as an excellent, approachable PyCon talk explaining the evolution and design of Python dataclasses.

sn9on Hacker News • Recommends

On “Ask HN: Best talks of 2018?”

Some of my favorite talks from Strange Loop: * Contracts For Getting More Programs Less Wrong: link * "It's Just Matrix Multiplication": Notation for Weaving: link * Hackett: a metaprogrammable Haskell: link * Git from the Ground Up: link From PyCon: * Beyond Unit Tests: Taking Your Testing to the Next Level: link * Dataclasses: The code generator to end all code generator: link to this video * Automating Code Quality: link There are probably more I might add later as I remember them.

kzrdudeon Hacker News • Recommends

On “Writing Pythonic Rust”

Raymond Hettinger's talks are great. I know it's not a succint blog post, but they are out there are watching a video is very approachable. Maybe link to this video (Dataclasses! We could cheekily say Python gets better at something Rust does - dataclasses makes Python better at records.) And link This talk (2013): link Unfortunately this video is now a bit out of touch with modern Python. Another (2013) classic: link it is very well known, and it has the very memorable advice: what's a class that only has one method? That should be a function!

lunchladydorison Hacker News • Mentions

On “Guide to Data Classes in Python 3.7”

I haven't watched it yet but I saw that Raymond Hettinger presented on data classes at PyCon last week 0. 0: link to this video

neulandon Hacker News • Mentions

On “Guide to Data Classes in Python 3.7”

…to use attrs without being bothered at all. In Raymond Hettinger's talk 0 at PyCon 2018, he even says that more features from attrs will likely get added, such as data validation 1. And that his talk was the one chance for the developer (Eric Smith) to get praise, because everyone is going to instantly second guess every decision he made. 0 link to this video 1 see 42:36 on future directions…