[Python-Dev] PEP 557: Data Classes

Mike Miller python-dev at mgmiller.net
Thu Oct 12 00:49:22 EDT 2017

On 2017-10-11 19:56, Nick Coghlan wrote:
>  From my perspective, the main benefit of a compound name like "data class" is 
> that it emphasises a deliberate behavioural choice (adopted from attrs): data 
> classes are just regular classes, with some definition time logic to help define 
> data fields.

IMO, the problem with the dataclass name isn't the data part, but the "class" 
part.  No other class has "class" in its name(?), not even object.  The 
Department of Redundancy Department will love it.

If it must be a compound name, it should rather be dataobject, no?

> By contrast, if we give them their own name (as with suggestions like record, 
> row, entity), that makes them start to sound more like enums: an alternative 
> base class with different runtime behaviour from a regular class.

This pep also adds many methods for use at runtime, though perhaps the behavior 
is more subtle.

> P.S. I'll grant that this reasoning doesn't entirely mesh with the naming of 
> "Abstract Base Class", but that phrase at least explicitly has the word "base" 
> in it, suggesting that inheritance is involved in the way it works.

There was some discussion over inheritance vs. decoration, not sure if it was 

(Just noticed that the abc module got away with a class name of "ABC," perhaps 
dataclass would be more palatable as "DC", though entity sounds a bit nicer.)


More information about the Python-Dev mailing list