Is there a way to pass a variable number of arguments to a function and change it using ( *args, **keywords )the argument passing style ? I tried several things, but either I don’t see the changes, or it has an error caused by the compiler:
def foo( *args ):
args[0] = 4
It gets me TypeError: object does not support assignment(these are tuples.) Or
def foo( *args ):
plusOne = [ item+1 for item in args ]
args = plusOne
which has no effect. If there is no mechanism and does not work, I can admit defeat.
Edit:
To clarify why I'm trying to go this route, consider the case here:
class bar(object):
def __init__(self,obj):
self.obj = obj
def foo( input ):
input.obj = "something else"
bar foo, . , deepcopy, , N . , . , .