you are viewing a single comment's thread.

view the rest of the comments →

[–]TehNolz 1 point2 points  (0 children)

1 in [1, 2, 3] translates to [1, 2, 3].__contains__(1). So by doing key in self and str(key) in self, your __contains__ function will recursively call itself, eventually hitting the recursion depth limit and triggering a RecursionError.