[Python-Dev] bool does not want to be subclassed? (original) (raw)

Phillip J. Eby pje at telecommunity.com
Tue Feb 17 09:27:43 EST 2004


At 08:55 AM 2/17/04 +0100, Martin v. Löwis wrote:

Phillip J. Eby wrote:

Actually, it might be even better to start with equality. Hashing is only meaningful for objects that can be tested for equality. However, in Python, all objects can be tested for equality. So hashing is meaningful for all objects? It is not: it is only meaningful for objects which compare equal to the same other objects over their lifespan.

That's not valid logic; "X is only meaningful for Y" means that X implies Y, not the other way around. The fact that Y is a tautology doesn't imply that X is true, in fact if Y is a tautology then it only proves that "X implies Y" is true, because everything implies Y.

However, I see your point that it's therefore silly to talk about things that imply a tautology. :) Anyway, if you read the rest of my post, you'd see that I explained the "lifespan" issue with a bit more precision than you have stated above. For example, I pointed out that it isn't necessary for an object to compare equal to the same other objects over its lifespan, only over the lifespan following its first hash invocation.



More information about the Python-Dev mailing list