I definitely agree with the overall thesis, however generic types would help further constrain your equals and less than methods. Both should take the same generic type Twhich would ideally be bounded by some Ordered or Comparable types.
Anyways, you are right that generics would help. In this sense, richer static typing (e.g., linear types, ownership types, dependent types) might help checking properties/constraints via testing. However, I think we have long ways to go until static typing can tackle the kind of issues tackled by testing.
I definitely agree with the overall thesis, however generic types would help further constrain your equals and less than methods. Both should take the same generic type
T
which would ideally be bounded by someOrdered
orComparable
types.I doubt Python type hints support generics yet.
Anyways, you are right that generics would help. In this sense, richer static typing (e.g., linear types, ownership types, dependent types) might help checking properties/constraints via testing. However, I think we have long ways to go until static typing can tackle the kind of issues tackled by testing.
They do: mypy.readthedocs.io/en/stable/gene...
True dat.
Good to know Python type hints supports generics :)