🐍🤝 Reconciling Python's dataclasses and properties
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
0_initial.py
1_private_field.py
2_initvar.py
3_field.py
4_wheels_field.py
5_init_false.py
LICENSE
README.md

README.md

Dataclass properties in Python

This is the supporting repository for "Reconciling Dataclasses And Properties In Python", a blog post published on my blog and (soon) dev.to.

The various Python files here are the attempts presented in the blog post to implement properties on dataclasses — which is not an intuitive task.

Usage

To run an interpreter using any of the attempts, you can make use of Python's -i command line argument, which starts a shell after running a script:

$ python -i 3_field.py
>>> # Start doing things with `Vehicle`!

Resources

Official documentation on dataclasses and features used in the blog post: