It crashes because it tries to convert 10**400 to a float and that fails:
>>> 10**400 / 1e200
Traceback (most recent call last):
File "<pyshell#10>", line 1, in <module>
10**400 / 1e200
OverflowError: int too large to convert to float
But with two ints it succeeds:
>>> 10**400 / 10**200
1e+200
Note that 1e200 is an integer:
>>> 1e200.is_integer()
True
So that could losslessly be converted to int, and then the division would succeed:
>>> 10**400 / int(1e200)
1e+200
So could/should 10**400 / 1e200 be implemented to do that instead of raising the error? Or is it a too rare use case and not worth the effort, or does something else speak against it?
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@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/O7FE5AAWPA77QRQPKJVT6AB3XK7QPUZG/
Code of Conduct: http://python.org/psf/codeofconduct/