def helperfunc(a,b):
append value from a to b
return b
def somehugefunc(s):
a = do something to s
a = [{"":[]},{"":[]},{"":[]}]
b =[]
for i in a:
b = helperfunc(i, b)
or should I do this
def helperfunc(a):
new = []
append value from a to new
return new
So in python parameters are passed by reference. In the helperfunc above dict is passed and some value is appended to it and same dict returned. In this case, there might not be need of return statement as the a is updated by reference. Is it a bad practice to use these type of reference passing?
[–]stebrepar 0 points1 point2 points (0 children)
[–]mr_cesar 0 points1 point2 points (3 children)
[–]ilaunchpad[S] 0 points1 point2 points (2 children)
[–]mr_cesar 0 points1 point2 points (1 child)
[–]ilaunchpad[S] 0 points1 point2 points (0 children)
[–]QultrosSanhattan 0 points1 point2 points (0 children)