Numeric comparison anomaly

Paul Rubin http
Fri Feb 21 00:33:36 CET 2003

Jim Meyer <jmeyer at> writes:
> While I understand that this is the correct behavior for the above
> implementation, I wonder if the implicit question wasn't "Shouldn't
> infinity evaluate to be equal to infinity?"
> Interestingly, Java considers the cases of both positive and negative
> infinity. They are respectively greater than and less than everything
> (except themselves); they are equal to themselves only.

Yeah, my original implementation had signed infinity, but then I
realized I only needed positive infinity, so I took out the sign.
Actually, my *original* original implementation had infinity compare
both larger than everything and smaller than everything.  The
application is something like regexps: pat{m,n} means k occurences
of pat, for some m <= k <= n, but both values default to "no limit".
So I wanted to have a single object that I could use as the default
for either m or n.  But it turned out to be simpler to just 
default m to 0 (I don't have to worry about negative values).

More information about the Python-list mailing list