On 18 September 2014 07:52, Ian Cordasco firstname.lastname@example.org wrote:
Actually there are 2 things here:
- Mathematically speaking, infinity is a real number and modulo
arithmetic is algebraically not defined for it. So the "mathematically reasonable value" is NaN. Is it intuitive for someone who hasn't studied abstract algebra? Probably not. Is it functional for the scientific python community? Almost certainly although I won't pretend to speak on their behalf
Right, as with NaN, infinity is a concept rather than a value. The fact that they both map to "kinda sorta values" in a programming language like Python is a limitation of the computer's underlying representational system, and the end result is a leaky abstraction that has some weird artefacts like this one (the fact that key lookup based containers enforce reflexivity, even though floating point NaN comparisons are explicitly defined as non-reflexive, is another).
There's no real way to make floating point arithmetic "not surprising" as soon as NaN and infinities get involved (while I'd be surprised if anyone was inclined to dispute that, here's a fun link on the "infinite values" side that will hopefully deter the unduly optimistic: https://en.wikipedia.org/wiki/Aleph_number).
- Changing this behaviour is not something I think we should do in a
minor version of 3.4 or in 3.5 (or really 3.x).
For a topic as inherently confusing as infinite values, I believe it would take a battery of extensive usability studies to make the case that any change in behaviour from the status quo would be worth the hassle, and most researchers are going to have more interesting things to do with their time.
Some of the things we changed in the Python 3 transition (like rearranging modules) were based on intuition as to what would be easier for newcomers to learn, and if I learned anything from that, it's to rely more heavily on the ethos of "status quo wins a stalemate" when it comes to the way we represent concepts that are just plain hard to learn in their own right.