typed_python
typed_python copied to clipboard
Comparison of OneOf instances doesn't match python.
if you have two instances of a OneOf(int, float) and you compare them, we check the type first and then we check the instance values. This doesn't match python, where 1.0 and 1 are equal. We can't normally invoke this behavior because we only get 'OneOf' instances indirectly (say, inside of a TupleOf). But we should still be mirroring python's behavior which is to call the comparison operator on the actual instances. This is actually quite a bit of work because we have totally separate pathways for this when you are comparing to a python value.
As an example, TupleOf(OneOf(int, float))((1.0,))
won't compare correctly to TupleOf(OneOf(int, float))((1,))
even though (1.0,) == (1,)
.