A few lines of code that show what I ask:
>>> x = ()
>>> for i in range(1000000):
... x = (x,)
>>> x.__hash__()
=============================== RESTART: Shell ===============================
1,000,000 may be excessive, but it demonstrates that there is some form of restriction on hashing nested tuples (and I accept other objects). To clarify, I did not restart the shell, this was done automatically when trying a hash.
What I want to know is what this limit is, why this happens (and why it did not cause an error), and is there any way around it (so that I can put such tuples in the form of sets or dictionaries).
source
share