Message262906
On Tue, Apr 05, 2016 at 02:20:19PM +0000, Robert Smallshire wrote:
> >> Were float to inherit from Rational, rather than Real ...
>
> > This would break the Liskov substitution principle.
>
> How so? Rational extends Real with only numerator, denominator and __float__. Isn't the existence of float.as_integer_ratio demonstration that numerator and denominator could be implemented?
Substitution principle:
Let phi(x) be a property provable about objects x of type T. Then phi(y) should
be true for objects y of type S where S is a subtype of T.
Use:
Let phi(n) = forall n: n elt nat => (1 / n) * n == 1
Counterexample:
n == 9992 |
|
Date |
User |
Action |
Args |
2016-04-05 14:37:39 | skrah | set | recipients:
+ skrah, tim.peters, rhettinger, facundobatista, mark.dickinson, christian.heimes, serhiy.storchaka, robert_smallshire, Austin Bingham |
2016-04-05 14:37:39 | skrah | link | issue26680 messages |
2016-04-05 14:37:38 | skrah | create | |
|