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.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4