Comparisons and sorting of a numeric class....
ethan at stoneleaf.us
Thu Jan 8 01:04:47 CET 2015
On 01/06/2015 07:37 PM, Andrew Robinson wrote:
> Explain; How does mere subclassing of bool break the contract that bool has?
> eg: What method or data would the superclass have that my subclass would not?
bool's contract is that there are only two values (True and False) and only one instance each of those two values (True
and False). If bool were subclassable, new values could be added with either completely different values (PartTrue) or
with more of the same value (True, ReallyTrue, AbsolutelyTrue) -- hence, broken contract.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 836 bytes
Desc: OpenPGP digital signature
More information about the Python-list