Let's say I have this code:
def test(some_args): some_args += ['two'] args = ['one'] test(args) print(args)When I run this code, the output is:
Output:['one', 'two']
Is there a way to append to a list WITHOUT an in-place assignment which modifies the parameter itself? I've tried .append('two'), but that doesn't work either. I realize that I can just make a copy of the list using .copy() or with slice notation, but I want to avoid creating an extra variable just for this purpose.