On Tue, May 18, 2021 at 12:39 AM Martin Teichmann < martin.teichm...@gmail.com> wrote:
> [...] > To give an example (this is not fake, but from the prototype): > > >>> 2/5 > 0.4 > >>> (2/5).denominator > 5 > >>> isinstance(2/5, float) > True > >>> type(2/5) > <class 'ratiofloat'> > > Note that this is only done at compile time, no such behavior is done at > run time, everything just behaves like normal floats: > > >>> two=2 > >>> five=5 > >>> (two/five) > 0.4 > >>> (two/five).numerator > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > AttributeError: 'float' object has no attribute 'numerator' > This violates a basic property of Python. If 1/2 has a certain property, then `x = 1; y = 2; x/2` should have the same property. Please don't go down this road. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>
_______________________________________________ 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/R3B7CA4KSOVECDRHCSYSXPNEHGOYZP5C/ Code of Conduct: http://python.org/psf/codeofconduct/