Fixing Incompatible Dunder Method Error in Mypy

When fixing one problem creates another problem in Python.

Photo by Stephanie Mulrooney on Unsplash
class Rank(Enum):
HIGH = [1, 8]
PAWN = [2, 7]
if self._first_move and (rank_start in Rank.PAWN):
...
if self._first_move and (rank_start in Rank.PAWN.value):
...
class Rank(list, Enum):
HIGH = [1, 8]
PAWN = [2, 7]
Definition of “__hash__” in base class “list” is incompatible with definition in base class “Enum”
class Rank(list, Enum): # type: ignore
HIGH = [1, 8]
PAWN = [2, 7]

--

--

C.D. Reimer makes topical videos about comic cons, pop culture, Silicon Valley and technology on YouTube. https://www.youtube.com/cdreimer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
C.D. Reimer

C.D. Reimer makes topical videos about comic cons, pop culture, Silicon Valley and technology on YouTube. https://www.youtube.com/cdreimer