Skip to content

Better __eq__ for generics #301

Closed
@ilevkivskyi

Description

@ilevkivskyi

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__.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions