On 2018-09-30 10:15, David Mertz wrote:
For similar reasons, I'd like an iInf too, FWIW.  It's good for an overflow value, although it's hard to get there in Python ints (would 'NaNAwareInt(1)/0' be an exception or iInf?).  Bonus points for anyone who knows the actual maximum size of Python ints :-).

However, the main use I'd have for iInf is simply as a starting value in a minimization loop.  E.g.

minimum = NaNAwareInt('inf')
for i in the_data:
    minimum = min(i, minimum)
    other_stuff(i, minimum, a, b, c)

I've written that code a fair number of times; usually I just pick a placeholder value that is "absurdly large relative to my domain", but a clean infinity would be slightly better.  E.g. 'minimum = 10**100'.

If we conceptualize iNan as "not an integer", then we can define operators in two manners:

Let be any operator:

1) "conservative" - operators that define ab==iNaN if either a or b is iNan
2) "decisive" - operators that never return iNan

With a decisive min(a, b), you can write the code you want without needing iINF