[Python-Dev] PEP 557: Data Classes

Mike Miller python-dev at mgmiller.net
Thu Sep 14 12:56:34 EDT 2017


On 2017-09-12 19:09, Nick Coghlan wrote:
> On 13 September 2017 at 02:01, Chris Barker - NOAA Federal
> <chris.barker at noaa.gov> wrote:
>> This really does match well with the record concept in databases, and most
>> people are familiar with that.
> 
> No, most people aren't familiar with that - they only become familiar
> with it *after* they've learned to program and learned what a database
> is.

Pretty sure he was talking about programmers, and they are introduced to the 
concept early.  Structs, objects with fields, random access files, databases, 
etc.  Lay-folks are familiar with "keeping records" as you mention, but they are 
not the primary customer it seems.

Record is the most common name for this ubiquitous concept.


> whether its referring to the noun (wreck-ord) or the verb (ree-cord).

This can be grasped from context quickly, and due to mentioned ubiquity, not 
likely to be a problem in the real world.  "Am I going to ree-cord this class?"


>> Also, considering their uses, it might make sense to put them in the
>> collections module.
> 
> Data classes are things you're likely to put *in* a collection, rather
> than really being collections themselves (they're only collections in
> the same sense that all Python classes are collections of attributes,
> and that's not the way the collections module uses the term).
> 

Yes, a collection of attributes, not significantly different than the namedtuple 
(that began this thread) or the various dictionaries implemented there already. 
The criteria doesn't appear to be very strict, should it be?

(Also, could be put into a submodule and imported into it maintain modularity. 
Where it lands though isn't so important, just that collections is relatively 
likely to be imported already on medium sized projects, and I think the 
definition fits, collections == "bags of stuff".)

Cheers,
-Mike


More information about the Python-Dev mailing list