For 2. you can just use collections.Hashable -- or maybe implement __hash__ somewhere in this architecture, such that a lazy conversion to a hashable type happens only when needed? (I'm not as close to the details here, this might not make sense).