Document field names and types with data classes#
Python’s data classes let you write classes that look more like classes in languages like C++ or Java, where you declare each member field’s type in advance. You use a decorator and write some type annotations, and you’ll get nice
__repr__ methods (among other things) automatically. Here’s an example:
Data classes provide good documentation (field names and types!).