3 ms·
That works well in Haskell, which turns literals into rationals (pairs of big integers) and calls an overloaded function fromRational on them implicitly. But Py
by creata 5y ago
That works well in Haskell, which turns literals into rationals (pairs of big integers) and calls an overloaded function fromRational on them implicitly. But Python can't do this kind of inference to give you a nice syntax, so I think this "sensible default behavior" would be a huge pain for users.
(Also, "correctness" seems like the wrong word: making rationals the default type would give you perfectly precise literals, but you'd immediately lose that once you perform almost any operation on them.)