4 ms·
> But two distinct Python tuples (1, 2, 3), which are not identical by your definition, do behave as identical keys in a Python dictionary. The numbers 2 and 4
by catnaroek 10y ago
> But two distinct Python tuples (1, 2, 3), which are not identical by your definition, do behave as identical keys in a Python dictionary.
The numbers 2 and 4 behave identically when passed to a function that tests whether its argument is an even number. Are 2 and 4 identical now?
> To you, it appears to mean that Python is violating Western logic.
This is the third time I'm saying I never said Python is violating Western logic. It's like saying I made a machine that violates gravity - it's literally impossible! Python just doesn't have compound values.
- pdonis 10y ago> The numbers 2 and 4 behave identically when passed to a function that tests whether its argument is an even number. Are 2 and 4 identical now? They are with respect to the even/odd property. So if that's the property I'm interested in, they're identical. They might not be if I'm interested in some other property. In other words, as dragonwriter has already pointed out, there is more than one concept of identity.
- catnaroek 10y ago> there is more than one concept of identity. There's only one: Two entities are equal if nothing can distinguish them. This is the “identity of indiscernibles”. In a language with abstract data types, such as Standard ML, you could define a new type whose internal representation is an integer, but which provides no operations that would distinguish between two even or two odd numbers. But Python doesn't have this.
- Retra 10y ago>There's only one: Two entities are equal if nothing can distinguish them. This is the “identity of indiscernibles”. This doesn't exist. If you can distinguish past and present, you can distinguish anything by time. An object in one moment is not identical to an object in another moment because the moment changed? No. You have to decide on what invariants you care about to have a consistent notion of identity. Yours is inadequate to do anything, as you demand the whole universe be invariant in all aspects; such a thing is trivial and vacuous. And it surely is not the structure encoded in any usage of the term "identity", as that word has non-trivial structure.
- catnaroek 10y ago> If you can distinguish past and present, you can distinguish anything by time. That's the thing: Objects exist in time. Values don't. Values exist in the language's semantics, which is a timeless mathematical object. Does it make sense to ask when the number 2 suddenly came into existence? > An object in one moment is not identical to an object in another moment because the moment changed? No. You have to decide on what invariants you care about to have a consistent notion of identity. You're confusing “identity of indiscernibles” with “indiscernibility of identicals”. And, obviously, you can't use the temporal properties of objects to determine whether their atemporal identities are equal. > Yours is inadequate to do anything, as you demand the whole universe be invariant in all aspects; such a thing is trivial and vacuous. Nope. It just requires you to distinguish between things that exist in time and things that exist independently of time.
- Retra 10y agoOh right, we're talking about extradimensional computers. I didn't realize.
- pdonis 10y ago> There's only one Maybe to you. Not to me. And not, I suspect, to most of the programmers in this discussion. > Python doesn't have this. Sure it does: class NerfedInteger(object): def __init__(self, i): self.__i = i def __repr__(self): return "<NerfedInteger({})>".format(self.__i) def __str__(self): return str(self.__i) @property def i(self): return self.__i
- catnaroek 10y agoWhat you've implemented isn't an abstract type. You can inspect the internal representation anytime, distinguishing between things that were meant never to be distinguished.