As long as I am commenting.
Code:
f = int(mg.group(1))
if f >= test_val:
return is_read_str
elif (f > 0) and (f < test_val):
return is_reading_str
else:
return is_not_read_str
The line you added could be
Code:
elif f > 0:
return is_reading_str
else:
because the if above has already removed all the cases that the clause after the 'and' would catch.