Hacker News new | past | comments | ask | show | jobs | submit login

> By definition identity checking is the finest-grained distinction you can make between things

By your definition, perhaps. The rest of us don't always use the word "identity" with this meaning. And since you don't own the English language, you don't get to tell the rest of us how to use words.

> If two things are identical, they can't possibly be different in any way.

Then by your definition, two Python tuples (1, 2, 3) are not identical. Which says absolutely nothing about how I can write programs using them, or what concepts of "identity" the operators in those programs can implement.

> This is what philosophers call...

We're talking about programming here, not philosophy.




> Which says absolutely nothing about how I can write programs using them,

I can write a program that treats all Python objects identically, by simply doing nothing. That doesn't make all Python objects actually identical.

> We're talking about programming here, not philosophy.

Programming is applied logic, which is a branch of philosophy.


> I can write a program that treats all Python objects identically, by simply doing nothing. That doesn't make all Python objects actually identical.

Yes, you can. Thank you for proving my point that Python programs don't have to use your definition of identity.

But that's a silly example. Here's an example that's not silly: in an earlier discussion you said dictionary keys have to be values--which would imply that dictionary key lookup must use your concept of "identity", so only two objects that are identical by your definition will behave as identical keys in a dictionary. But two distinct Python tuples (1, 2, 3), which are not identical by your definition, do behave as identical keys in a Python dictionary. In other words, Python dictionary key lookup does not use your concept of "identity".

To everyone else, this means your concept of identity is simply not relevant. To you, it appears to mean that Python is violating Western logic.

> Programming is applied logic, which is a branch of philosophy.

To you, perhaps. Not to me. And not, I suspect, to most of the other programmers in this discussion.


> 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.


> 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.


> 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.


>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.


> 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.


Oh right, we're talking about extradimensional computers. I didn't realize.


> 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


What 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.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: