About the implementation of del in Python 3
On Thu, 6 Jul 2017 07:24 pm, Marko Rauhamaa wrote:
> While talking about addresses might or might not be constructive, let me
> just point out that there is no outwardly visible distinction between
> "address" or "identity".
Er, yes there is. Address refers to a position in space. Identity refers to the
state or quality of being identical (i.e. the same). My identity remains the
same as I travel from one address to another.
> Equally well, we could replace those words with:
> serial number
> fixed asset tag
> social security number
Those are good ID numbers.
> fermionic quantum state
I don't think that is, since two electrons (fermions) in different atoms can be
in the same state.
Identical twins would have something to say about that.
In practice, the uniqueness of fingerprints is problematic, but I'll grant that
at least in principle they would make good IDs.
> cryptographic hash
By the pigeonhole principle, not actually unique. Only probably unique, provided
the number of objects given IDs is significantly smaller than the total number
of hashes. E.g. if you have 2**128+1 objects using a 128-bit hash, then there
must be two distinct objects with the same hash.
> Ignoring the word that is used to talk about object identity, it would
> be nice to have a precise formal definition for it. For example, I know
> that any sound implementation of Python would guarantee:
> >>> def f(a): return a
> >>> a = object()
> >>> a is f(a)
> But how do I know it?
Which part is unclear? The fact that f(a) returns a, or the fact that `a is a`
First part is implied by Python's execution model, and the second by the
definition of the `is` operator.
I'm genuinely unsure what part of this you think needs a precise formal
(That's even putting aside that it may not be possible to give a precise formal
definition of "identity". See, for example, "The Axe of my Grandfather"
?Cheer up,? they said, ?things could be worse.? So I cheered up, and sure
enough, things got worse.