Tho Le

A Data Scientist. Looking for knowledge!

Python - New Concepts

03 Aug 2025 » python, advanced

dataclasses

  • A new utility in Python 3.7. Like normal classess in Python, but have some basic funcs like instantiation, comparing, printing.
  • Used to create classes that are purely config/container (ie.e, to store data), rather than classes to simulate logic/behaviors.
  • Can make classess less wordy. See above link for an example.
  • field is a func within dataclasses, to control attributes of a class.