<div dir="ltr"><div class="gmail_default" style="font-size:small">On Thu, Oct 12, 2017 at 9:20 AM, Mike Miller <span dir="ltr"><<a href="mailto:python-dev@mgmiller.net" target="_blank">python-dev@mgmiller.net</a>></span> wrote:<br></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
On 2017-10-12 00:36, Stéfane Fermigier wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
"An object that is not defined by its attributes, but rather by a thread of continuity and its identity." (from <a href="https://en.wikipedia.org/wiki/Domain-driven_design#Building_blocks" rel="noreferrer" target="_blank">https://en.wikipedia.org/wiki/<wbr>Domain-driven_design#Building_<wbr>blocks</a>)<br>
</blockquote>
<br>
Not sure I follow all this, but Python objects do have identities once instantiated.  e.g. >>> id('')<br>
<br></blockquote><div><div class="gmail_default" style="font-size:small;display:inline">​It seems to me that the quoted document is attempting to make a distinction ​similar to the one between classes (entities) and instances (value objects). The reason I liked "row" as a name is because it resembles  "vector" and hence is loosely assocaited with the concept of a tuple as well as being familiar to database users. In fact the answer to a relational query was, I believe, originally formally defined as a set of tuples.</div></div><div><br></div><div><div class="gmail_default" style="font-size:small">​Sometimes one can simply be too hifalutin' [<a href="http://www.dictionary.com/browse/hifalutin]">http://www.dictionary.com/browse/hifalutin]</a>​, and language that attempts to be precise obscures meaning to the less specialised reader.</div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
See also the more general Wikipedia definition "An entity is something that exists as itself, as a subject or as an object, actually or potentially, concretely or abstractly, physically or not." (<a href="https://en.wikipedia.org/wiki/Entity" rel="noreferrer" target="_blank">https://en.wikipedia.org/wiki<wbr>/Entity</a>).<br>
<br>
In the context of DDD, entities are usually opposed to value objects: "An object that contains attributes but has no conceptual identity. They should be treated as immutable.". (<a href="https://en.wikipedia.org/wiki/Domain-driven_design#Building_blocks" rel="noreferrer" target="_blank">https://en.wikipedia.org/wiki<wbr>/Domain-driven_design#Building<wbr>_blocks</a>)<br>
<br>
Attrs, and by extension the dataclass proposal (I guess), provide some support for both:<br>
<br>
- Providing support for quickly constructing immutable objects from a bag of attributes, and providing equality based on those attributes, it helps implement Value Objects (not sure much more is needed actually)<br>
<br>
- By supporting equality based on some "primary key", it will also help with maintaining the concept of "equality" in entities.<br>
</blockquote>
<br>
I don't believe either module particularly supports or restricts immutability?<span class="gmail-HOEnZb"><font color="#888888"><br>
<br>
-Mike</font></span><div class="gmail-HOEnZb"><div class="gmail-h5"><br></div></div></blockquote></div></div></div>