> > What's wrong with my implementation of __hash__ raising a TypeError with > > the attribution 'unhashable object'. > > A subtype shouldn't change contracts of its supertypes. hash() was > implicitly contracted as "raising no exceptions". Let's not confuse subtypes and subclasses. One of the things implicit in the discussion on types-sig is that not every subclass is a subtype! Yes, this violates something we all learned from C++ -- but it's a great insight. No time to explain it more, but for me, Peter's subclassing UserString for MutableString to borrow implementation is fine. --Guido van Rossum (home page: http://www.python.org/~guido/)
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