Category: dataclasses

Problem

Define data containers with dataclasses.

Solution

  @dataclass
class Point:
    x: float
    y: float
  

Notes

  • Adapt variable names and paths to your project
  • Add error handling for production use
  • See related chapters in the Learning Path