Performance when passing huge list as argument in recursive function?
问题 I am using Python and I have a recursive function that takes a huge list as one of the arguments: # Current implementation def MyFunction(arg1, arg2, my_huge_list) ... ... MyFunction(new_arg1, new_arg2, my_huge_list) As you can see above, MyFunction is called recursively using the same list my_huge_list ; this doesn't change, unlike the other arguments. And, again, this list is huge. A friend of mine suggested that I could treat my_huge_list as a global variable to improve the performance, as