Using Data Classes in Python

One new and exciting feature that came out in Python 3.7 was the data class. A data class is a class typically containing mainly data, although there aren’t really any restrictions.

With data classes, you don’t have to write boilerplate code to get proper initialization, representation, and comparisons for your objects.

In this course, you’ll learn how to:

  • Define your own data classes
  • Add default values to the fields in your data class
  • Customize the ordering of data class objects
  • Work with immutable data classes

What’s Included:

Downloadable Resources:

Related Learning Paths:

About Darren Jones

Darren Jones Darren Jones

With 20 years as a teacher of music technology, Darren is keen to bring his skills to the Python table.

» More about Darren

Each tutorial at Real Python is created by a team of developers so that it meets our high quality standards. The team members who worked on this tutorial are:

« Browse All Courses