◐ Shell
clean mode source ↗

Better __eq__ for generics

Currently, Iterable[T][int] == Iterable[int] returns False. It could be convenient to implement an __eq__ that returns True for generics that are considered the same from the point of view of static type checkers.

Of course, there is a very simple way to do this: just compare the new repr for two classes :-)
But probably the right way would be to factor out the algorithm from the new repr that "substitutes" type variables and use it for both repr and __eq__.