In python, if I have a recursive function that modifies a list of integers, and assume the list is large, which is faster to do: keep the list as a global variable, and not pass it as an argument, or pass it as an argument and not make it global?
Share
Lists are passed by adress, so extra overhead is just single function parameter (pointer). I dont think it is noticeable.
You have to test yourself, but I would be surprised if it would be significant.