Re: RuntimeError: maximum recursion depth exceeded in cmp

2012-02-16 Thread OwenLJN
Let me restate my question:I want to make self_contained(L5) and self_contained(L6) work, but I get RuntimeError how can I fix this by adding one more parameter to check if a list inside a list was seen before, and then stop the loop to prevent the error message from showing again? And I found that

RuntimeError: maximum recursion depth exceeded in cmp

2012-02-16 Thread OwenLJN
Hi I wrote a python function self_contained(x) that finds all lists in x that contain themselves. Here's the body of the function: def self_contained(x): L = [] if not isinstance(x, list): return [] for i in x: if isinstance(i, list): if i in i: