Hi Paul,

> But *not* in sympy, in normal Python, if m == 1 and v == 1, then 1/2 *
> m * v**2 is 0.5 (a float) currently, as is (m/2) * v**2. But in your
> proposal, the former will be a float/fraction hybrid, whereas the
> latter will be a float.

No. In my proposal, this will simply be a float. Why? Because my ratiofloats 
are only generated during compile time. At runtime, they behave like normal 
floats, so when you calculate (1/2) * x with x being 1, you get 0.5, just  
float.

> And what about
> x = 1
> a = 1/3
> b = x/3
> a == Fraction(1,3)
> b == Fraction(1,3)
> a == b
> Currently these are False, False, True. You'll change that to True,
> False, True and you've now broken the idea that things that are equal
> should compare the same to a 3rd value.

Indeed, one could break transitivity here if the implementer of Fraction chose 
so. But transitivity is not a required thing for == in Python, numpy even 
returns arrays for it...

Cheers

Martin
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/GKRDYSPQHJDXLGVXJKKFUKPXIRM3IOVU/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to