On Sat, May 15, 2021 at 3:51 AM Martin Teichmann <martin.teichm...@gmail.com> wrote: > > Hi Chris, > > I think you did not get my point. I do not want to allow x/y. I want to only > allow literals, as in 3/2. This would then be a new kind of literal, that has > the type of Fraction. Much like 2.5 is a float, but x.y means something > completely different, even though it has no spaces. So x/y would mean "divide > x by y" or actually call __truediv__ on x plus some details, while 2/3 would > just be the constant two-thirds. 2 / 3 would then mean the same as it used > to: divide 2 by 3, giving some 0.666ish. >
Ahhh, I see what you mean. That's more plausible than what I was thinking of, but I think it'd still be cleaner to just adorn an integer with a letter to mark that it should be a Fraction instead (since Fraction divided by int, or int divided by Fraction, will yield the correct Fraction result). ChrisA _______________________________________________ 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/WJVXHMUPJFFJGI4XAJJKU2Z5WI7QJVK7/ Code of Conduct: http://python.org/psf/codeofconduct/