Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Runtime Error with copy.deepcopy in Python

I need to manipulate a large list of objects. Now, I need to invoke copy.deepcopy and it raises a RunTimeError: maximum recursion depth exceeded (Its OK when I try it with a smaller list.). My question is: Is there any other way to get the feature of copy.deepcopy which does not have this problem? Regards.

like image 890
hola Avatar asked Sep 09 '13 11:09

hola


1 Answers

You've probably an extremely deep structure. You should increase your recursion limit:

 sys.setrecursionlimit(10000)  # default is 1000 in my installation
like image 90
Alfe Avatar answered Oct 06 '22 06:10

Alfe