10.13 A Brief Intro to Python 3.7’s New Data Classes
Though named tuples allow you to reference their members by name, they’re still just tuples, not classes. For some of the benefits of named tuples, plus the capabilities that traditional Python classes provide, you can use Python 3.7’s new data classes12 from the Python Standard Library’s dataclasses
module.
Data classes are among Python 3.7’s most important new features. They help you build classes faster by using more concise notation and by autogenerating “boilerplate” code that’s common in most classes. They could become the preferred way to define many Python classes. In this section, we’ll present data-class fundamentals. At the end of the ...
Get Intro to Python for Computer Science and Data Science: Learning to Program with AI, Big Data and The Cloud now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.