Modern feature that has most changed my use of Python: dataclasses. Not just useful for data structures — they let you separate state from implementation of any class. Also dataclasses tend to be more useful by default, since they come with repr, eq, etc.

May 6, 2022 · 8:05 PM UTC

6
21
2
275
Replying to @gdb
I realized I use dataclasses more and more over time. You’re right: super useful!
Replying to @gdb
Cross pollination from scala
1
4
Replying to @gdb
can u give some examples? thanks! willing to learn!
3
Replying to @gdb
Damn Java has invaded
1
Replying to @gdb
Best use of dataclasses I've seen recently: Equinox. All Modules are dataclasses that self-register as PyTrees, so Modules to be used functionally with all Jax primitives (`self` is a pytree), and all parameters are accessible via jax.tree_map. github.com/patrick-kidger/eq…
1
12
Replying to @gdb
There needs to be new innovation on the data classes front. Even data types too. We need to push bits to their limits