On 5/14/2021 5:29 PM, Ethan Furman wrote:
On 5/14/21 5:12 AM, Martin Teichmann wrote:
In order to showcase how that would look like, let me give an example session:
>>> 5/6-4/15 17/30 >>> a=22/7 >>> f"{a}" '22/7' >>> f"{a:f}" '3.142857' >>> from decimal import Decimal >>> Decimal(1/3) Decimal('0.3333333333333333333333333333')
This looks very interesting! I see some confusion on all sides on what, exactly, you are proposing. As best as I can figure, the rules for your conversions are something like (where .div. is division and .op. is any other operation):
1) int .div. int --> fraction
2) int .op. fraction --> fraction
3) fraction .op. non-fraction --> float
What I am not sure of:
4) fraction .op. fraction --> ???
5) fraction .op. non-fraction --> ???
Am I correct on 1-3? What are you proposing as regards 4 and 5?
My understanding of the proposal is that OP is only talking about <literal-integer> / <literal-integer> becomes a Fraction. So: x=1 x/2 # unchanged, still yields a float. It's only literals like "1/2" that would become Fraction(1,2). Eric