简体   繁体   中英

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.

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

 sys.setrecursionlimit(10000)  # default is 1000 in my installation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM