[Python-Dev] PEP 557: Data Classes

Mike Miller python-dev at mgmiller.net
Thu Sep 14 13:24:52 EDT 2017


On 2017-09-12 21:05, Guido van Rossum wrote:
> It's ironic that some people dislike "data classes" because these are regular 
> classes, not just for data, while others are proposing alternative names that 
> emphasize the data container aspect. So "data classes" splits the difference, by 
> referring to both data and classes.

True that these data-classes will be a superset of a traditional record.  But, 
we already have objects and inheritance for those use cases.  The data-class is 
meant to be used primarily like a record, so why not name it that way?

Almost everything is extensible in Python; that shouldn't prevent focused names, 
should it?


> Let's bikeshed about something else.

An elegant name can make the difference between another obscure module thrown in 
the stdlib to be never seen again and one that gets used every day.  Which is 
more intuitive?

     from collections import record

     from dataclass import dataclass



Would the language be as nice if "object" was named an "instanceclass?"  Or 
perhaps the "requests" module could have been named "httpcall."  Much of the 
reluctance to use the attrs module is about its weird naming.

Due to the fact that this is a simple, potentially ubiquitous enhancement an 
elegant name is important.  "For humans," or something, haha.

-Mike


More information about the Python-Dev mailing list