Back in college I was writing a parser for a personal project in python. I was adding nodes to a set, but somewhere down the pipeline, some of the items I added to this set mysteriously disappeared!

I never removed anything from this set, nor did I replace it, so it baffled me that I couldn't find some items in the set.

It turned out the problem was I updated fields in these nodes that were used for taking the node's __hash__, which would prevent them from being found in the set


Add Comment