DEV Community

Discussion on: Static Typing vs Testing == Apples vs Oranges

Collapse
 
evanoman profile image
Evan Oman

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.

Collapse
 
rvprasad profile image
Venkatesh-Prasad Ranganath • Edited

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.

Collapse
 
dmerejkowsky profile image
Dimitri Merejkowsky

I doubt Python type hints support generics yet.

They do: mypy.readthedocs.io/en/stable/gene...

(e.g., linear types, ownership types, dependent types)

True dat.

Thread Thread
 
rvprasad profile image
Venkatesh-Prasad Ranganath

Good to know Python type hints supports generics :)