Get the latest tech news

Use keyword-only arguments in Python dataclasses


Python dataclasses are a really nice feature for constructing classes that primarily hold or work with data. They can be a good alternative to using dictionaries, since they allow you to add methods, dynamic properties, and subclasses. They can also be a good alternative to building your own class by hand, since they don't need…

Python dataclasses are a really nice feature for constructing classes that primarily hold or work with data. They can also be a good alternative to building your own class by hand, since they don’t need a custom__init__() that reassigns attributes and provide methods like__eq__() out of the box. We spend a lot of time trying to ensure backwards-compatibility and forwards-extensibility in Review Board, so this is an important topic for us.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Keyword

Keyword

Photo of python

python

Photo of arguments

arguments

Related news:

News photo

Python can run Mojo now

News photo

Dynamic YAML with Python computed properties for fusing API workflows and SQL

News photo

A Python-first data lakehouse