Quick one hopefully; brain has gone blank.
Is it possible / practical to have a class that is just a generic numeric value (eg float, int, etc) that when a value becomes <=0 it loops around to os.maxint-value, similar to a unsigned value in C?
'This is completely insane' is also an acceptable answer!
'Reasonable' use cause; a particular 'effort' cost evaluation where a negative 'cost' is, while theoretically fine, practically invalid and is usually checked for each value and flipped to maxint if <=0.
Instead of all those lovely additional comparisons, just give the cost-value this inate behaviour.
Found the answer
Using Numpy's uint types works for this.
import numpy.uint32
valueA=uint32(5)
valueB=uint32(-5)
assert valueA < valueB
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With