At 01:50 PM 1/11/05 -0500, Clark C. Evans wrote: >On Tue, Jan 11, 2005 at 12:54:36PM -0500, Phillip J. Eby wrote: >| * Replacing LiskovViolation is possible by dropping type/isinstance >| checks from adapt(), and adding an isinstance check to >| object.__conform__; Liskov violators then override __conform__ in their >| class to return None when asked to conform to a protocol they wish to >| reject, and return super().__conform__ for all other cases. This >| achieves your use case while simplifying both the implementation and the >| usage. > >I'd rather not assume that class inheritance implies substitutability, Hm, you should take that up with Alex then, since that is what his current PEP 246 draft does. :) Actually, the earlier drafts did that too, so I'm not sure why you want to change this now. What I've actually suggested here actually allows for inheritance=substitutability as the default, but also makes it trivially changeable for any given inheritance hierarchy by overriding __conform__ at the base of that hierarchy, and without introducing a special exception class to do it.
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