On Tue, Oct 24, 2000 at 04:50:32PM -0500, Guido van Rossum wrote: > Rather than formalizing the exceptions made for instances, we > should work on eradicating the differences between classes and > types. Yes, I see this now. Those PyInstance_Check() calls should really go away. Instead, the type should be responsible for providing different behavior. > I believe that the plans for rich comparisons would or could > also take care of this. I've just briefly looked at the proposal. It consists of two parts. One is splitting __cmp__ into __gt__, __lt__, etc. That is a separate issue to the one we are dicussing. The other part is directly related. In order for types to define their own comparison behavior, it proposes that types have an optional pointer to a rich comparison function in the type structure. I think this is the right idea but it doesn't go far enough. Every operation should be implementable by the type. Code like: if (PyString_Check(obj)) { something } else if (PyInstance_Check(obj)) { something else } ... should disappear unless it is need for performance reasons. I think we are close to achieving this goal. I'll try to come up with a proposal. Neil
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