[Python-Dev] PEP 557: Data Classes

Nick Coghlan ncoghlan at gmail.com
Thu Oct 12 02:05:43 EDT 2017


On 12 October 2017 at 14:49, Mike Miller <python-dev at mgmiller.net> wrote:

>
> 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?
>

No, because dataclass is the name of a class decorator ("This class is a
data class"), not the name of a type.

It's akin to "static method", "class method", and "instance method" for
function definitions (although the last one isn't a typical decorator,
since it's the default behaviour for functions placed inside a class).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20171012/09358afc/attachment.html>


More information about the Python-Dev mailing list