Ask Your Question

RecursionError long lists

asked 2021-04-09 05:53:19 +0200

Ingrid gravatar image

I am working with long lists, and getting the error "RecursionError: maximum recursion depth exceeded in comparison". The maximum recursion limit is 3000, if I try increasing it the kernel dies. My first list has only about 10,000 elements, representing 5 dimensional simplices. There are 6 different "face maps" I want to apply to each element in the list. If a face map applied to an element of the list is not in my list of 4 dimensional simplices, I want to append it to my list of 4 dimensional simplices. The list of 4 dimensional simplices has length nearly 6 times that of my list of 5 dimensional simplices. Similarly when generating the list of 3 dimensional simplices, this will have length nearly 30,000. Etc. down to the list of 1 dimensional simplices. The numbers don't quite increase multiplicatively, as there are identifications, but the numbers are big enough that I would really rather not compute in steps of 3000. Is there any way around this? The manipulations I want to do to the lists aren't computation intensive, I don't understand why this is such a problem.

edit retag flag offensive close merge delete


Without code and traceback, we cannot help.

FrédéricC gravatar imageFrédéricC ( 2021-04-09 08:40:32 +0200 )edit

Providing a toy example with a few simplices instead of 10,000 would make the question concrete.

slelievre gravatar imageslelievre ( 2021-04-09 10:01:06 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2021-04-09 13:33:48 +0200

Ingrid gravatar image

I have found the problem. Sorry for wasting your time everyone. The lists themselves were not too long. There was a freak coincidence, which caused random elements of the list to be a 10,000 deep nested sequence of lists.

edit flag offensive delete link more


Nice. Accept your own answer to mark the question as solved.

slelievre gravatar imageslelievre ( 2021-04-09 17:40:06 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2021-04-09 05:53:19 +0200

Seen: 202 times

Last updated: Apr 09 '21