This is my first question on the forum, and I'm also very new to Python, so maybe that doesn't make much sense, but I'm just wondering ...
This is very related, but IMO this question Slicing a list in Python without creating a copy does not answer the question of how to cut a list so that changing the slice changes the original?
Say, if I want to change only part of the list in a function and make sure that the function does not have access to all members, how can I write this:
def myFunc(aList):
for i in range(0,len(aList)):
aList[i] = 0
wholeList = range(0,10)
partOfList = wholeList[3:6]
myFunc(partOfList)
so in the end wholeListwill be
[0, 1, 2, 0, 0, 0, 6, 7, 8, 9]
??
I think this would work if the content wholeListwas a mutable object, but with numbers is this the only way to return a myFunclist of changes and assign in a workspace call?