[Python-Dev] PEP 557: Data Classes
sf at fermigier.com
Thu Oct 12 05:24:18 EDT 2017
On Thu, Oct 12, 2017 at 10:20 AM, Mike Miller <python-dev at mgmiller.net>
> On 2017-10-12 00:36, Stéfane Fermigier wrote:
>> "An object that is not defined by its attributes, but rather by a thread
>> of continuity and its identity." (from https://en.wikipedia.org/wiki/
> Not sure I follow all this, but Python objects do have identities once
> instantiated. e.g. >>> id('')
Yes, for the lifetime of the object in the Python VM.
But if you are dealing with objects that are persisted using some kind of
ORM, ODM, OODB, then it wont work.
It's quite common (but not always the best solution) to use some kind of
UUID to represent the identity of each entity.
Also, there can be circumstances where two objects can exist at the same
time in the VM which represent the same object, in which case one should
ensure that a == b iff a.uid == a.uid (in the case 'uid' is the attribute
used to carry the unique identifier).
> I don't believe either module particularly supports or restricts
> Python-Dev mailing list
> Python-Dev at python.org
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/sfermigie
Stefane Fermigier - http://fermigier.com/ - http://twitter.com/sfermigier -
Founder & CEO, Abilian - Enterprise Social Software -
Chairman, Free&OSS Group / Systematic Cluster -
Co-Chairman, National Council for Free & Open Source Software (CNLL) -
Founder & Organiser, PyData Paris - http://pydata.fr/
“You never change things by ﬁghting the existing reality. To change
something, build a new model that makes the existing model obsolete.” — R.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-Dev