On Sat, Apr 30, 2022 at 11:54:47PM -0700, Christopher Barker wrote:
> On Sat, Apr 30, 2022 at 6:40 PM Steven D'Aprano <st...@pearwood.info> wrote:
> 
> > On Sat, Apr 23, 2022 at 12:11:07PM -0700, Christopher Barker wrote:
> > > Absolutely. However, this is not an "all Classes" question.
> >
> > Isn't it? I thought this was a proposal to allow any class to partake in
> > the dataclass autoassignment feature.
> >
> 
> no -- it's about only a small part of that.

How so? Dataclasses support autoassignment. This proposes to allow 
**all classes** (including non-dataclasses) to also support 
autoassignment.

So can you pleae clarify your meaning. To me, this does look like an 
"all Classes" question. What am I missing?


> > > I don't think of dataclasses as "mutable namedtuples with defaults" at
> > all.
> > What do you think of them as?
> >
> 
> I answered that in the next line, that you quote.

Perhaps your answer isn't as clear as you think it is. See below.


> > > But do think they are for classes that are primarily about storing a
> > > defined set of data.
> >
> > Ah, mutable named tuples, with or without defaults? :-)
> >
> 
> well, no. - the key is that you can add other methods to them, and produce
> all sort of varyingly complex functionality. I have done that myself.

Named tuples support all of that too.

One of the reasons I have not glommed onto dataclasses is that for my 
purposes, they don't seem to add much that named tuples didn't already 
give us.

* Record- or struct-like named fields? Check.

* Automatic equality? Check.

* Nice repr? Check.

* Can add arbitrary methods and override existing methods? Check.

Perhaps named tuples offer *too much**:

* Instances of tuple;

* Equality with other tuples;

and maybe dataclasses offer some features I haven't needed yet, but it 
seems to me that named tuples and dataclasses are two solutions to the 
same problem: how to create a record with named fields.


> > Or possibly records/structs.
> >
> 
> nope, nope, and nope.

Okay, I really have no idea what you think dataclasses are, if you don't 
think of them as something like an object-oriented kind of record or 
struct (a class with named data fields).

You even define them in terms of storing a defined set of data, except 
you clearly don't mean a set in the mathematical meaning of an unordered 
collection (i.e. set()). A set of data is another term for a record.

So I don't understand what you think dataclasses are, if you vehemently
deny that they are records (not just one nope, but three).

And since I don't understand your concept of dataclasses, I don't know 
how to treat your position in this discussion. Should I treat it as 
mainstream, or idiosyncratic? Right now, it seems pretty idiosyncratic.

Maybe that's because I don't understand you. See below.


> But anyway, the rest of my post was the real point, and we're busy arguing
> semantics here.

Well yes, because if we don't agree on semantics, we cannot possibly 
communicate. Semantics is the **meaning of our words and concepts**. If 
we don't agree on what those words mean, then how do we understand each 
other?

I've never understood people who seem to prefer to talk past one another 
with misunderstanding after misunderstanding rather than "argue 
semantics" and clarify precisely what they mean.


-- 
Steve
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/WYQA2TFZEVVQRFMWBBJXSFA4WXKYNZWT/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to