On Saturday, February 15, 2014 10:50:35 AM UTC+5:30, Ian wrote:
> On Fri, Feb 14, 2014 at 9:24 PM, Rustom Mody  wrote:
> > In the case of physical objects like dice there is a fairly
> > unquestionable framing that makes identity straightforward --
> > 4-dimensional space-time coordiantes. If the space-time coordinates of
> > 2 objects are all equal then the objects are identical, else not.
> > Now we analogize the space-time identity of physical objects to
> > computer identity of computer objects (so-called) and all sorts of
> > problems ensue.
> > To start with we say two objects are identical if they have the same
> > memory address.

> This is false.  It happens to hold for CPython, but that's an
> implementation detail.  The definition of object identity does not
> depend on memory address.  It also doesn't have anything to do with
> space-time coordinates.  The concept of object identity is an
> abstraction, not an analogy from physics.

> The language reference states, "Every object has an identity, a type
> and a value. An object's identity never changes once it has been
> created; you may think of it as the object's address in memory."
> Okay, so that quote does bring up memory address, but in my
> interpretation that's just an analogy to introduce the concept.  The
> more important part of that sentence is the first part, which ties an
> object's identity to its creation.  If two objects share the same
> creation, then they're the same object.

Whats the notion of object identity is the question.
Ok so you reject the memory addr as an 'implementation detail'
Then you are obliged to provide some other way of understanding object-identity


On Saturday, February 15, 2014 11:01:35 AM UTC+5:30, Chris Angelico wrote:
> On Sat, Feb 15, 2014 at 4:20 PM, Ian Kelly  wrote:
> > On Fri, Feb 14, 2014 at 9:24 PM, Rustom Mody wrote:
> >> To start with we say two objects are identical if they have the same
> >> memory address.
> > This is false.  It happens to hold for CPython, but that's an
> > implementation detail.  The definition of object identity does not
> > depend on memory address.  It also doesn't have anything to do with
> > space-time coordinates.  The concept of object identity is an
> > abstraction, not an analogy from physics.

> With the restrictions of computer memory, I suspect that two objects
> with the same address must be identical, simply because it's not
> possible for it to be otherwise. However, the converse isn't
> necessarily true; two objects may have the same identity while being
> at different addresses (or, more likely, one object may occupy
> different memory addresses over time, if the gc moves it around). But
> since memory addresses are completely inaccessible to Python code, we
> can't say whether two objects have the same address.

Nice point!
I earlier talked of the macro problems of identity, viz across machines.
You are bringing up a more 'micro' angle, viz gc.
An even more micro (or lower level) example would be the mismatch between
physical and virtual memory, dram and cache etc etc.
Is memory such a clear concept?

Just different examples to show that object identity is anything but
straightforward
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to