Skip to content
This repository has been archived by the owner on Nov 15, 2019. It is now read-only.

florimondmanca/dataclasses-properties

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

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: