In C++, it's good practice to pass references to large data structures to avoid the overhead of copying the whole thing by value. Python works very differently, though, and I'm wondering how best to pass a large data structure.
Here's the simple version. Is this what I should use, or is there something better?
foo(hugeArray):
# Change values in hugeArray
return hugeArray
hugeArray = foo(hugeArray)
Solution (Kudos to jonrsharpe!)
foo(hugeArray)
hugeArray[0] = "New!"
myArray[0] = "Old."
foo(myArray)
print myArray[0] # Prints "New!"
The function changes the original array, so there's no need to assign the return value to the original to change it.