I use inf/-inf as initial values to find minimum/maximum value of a measurement. Lets say that you measure temperature with a sensor and you want to keep track of minimum/maximum temperature. The sensor might provide a valid temperature or might be broken. Pseudocode:
# initial value of the temperature
t = float('nan')
# initial value of minimum temperature, so any measured temp. will be smaller
t_min = float('inf')
# initial value of maximum temperature, so any measured temp. will be bigger
t_max = float('-inf')
while True:
# measure temperature, if sensor is broken t is not changed
t = measure()
# find new minimum temperature
t_min = min(t_min, t)
# find new maximum temperature
t_max = max(t_max, t)
The above code works because inf/-inf/nan are valid for min/max operation, so there is no need to deal with exceptions.