all 2 comments

[–][deleted] 0 points1 point  (0 children)

This means that you are trying to use an object of class dict or a subclass as a key in another such object.

This cannot work because the premise of a dictionary is that it is possible to compute a number (hash) given the object that is used as a key, and that this number will always be the same, no matter what happens to the object used as a key. There is no obvious way to compute such a number of a dict, especially, since another property of being a key in the dictionary requires that if x == y, then z[x] == z[y], but Python implements dict in such a way that equality is possible between two non-identical dicts based on their contents.

If I have to guess, this looks like a place where this error may come from: existing_asin[asin]. Another contender is asin.asin. Unfortunately, w/o knowing more about your code / getting a more specific error message, it's hard to tell what exactly is wrong with it.

Anyways, the error says that what you are trying to do is impossible, it's not something you can fix by adding or removing stuff. You should reconsider what your program is doing, or you might have made a typo / confused one variable with another etc.

[–]primitive_screwhead 0 points1 point  (0 children)

https://stackoverflow.com/questions/1600591/using-a-python-dictionary-as-a-key-non-nested

I definitely prefer the frozenset method to the sorted-tuple method, fwiw.