Fixing The Incompatible Dunder Method Error in Mypy

Photo by Stephanie Mulrooney on Unsplash

While cleaning up my code in a chess program that I’m writing in Python as a learning exercise, I created an Enum class to represent the starting ranks for certain pieces on the board. Since I wanted the Enum to also behave like a list, I added that to the class definition. The mypy static type checker reported an incompatible __hash__ dunder method error between list and Enum. I came up with a solution for that problem.

Read my essay and follow me on Medium. Your support is greatly appreciated.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.