That article promulgates a misunderstanding about immutability. For my way of thinking, python is already an interpreted language and I can enforce tropes in code more cleanly and effectively than people taking something five levels up at face value and trying to figure out what sticks when they throw it against the wall: no wonder they end up frustrated, and it's a frustrating situation.
Given:
def foo(*args):
print(args)
return
class Thing(object):
def __init__(self,a,b):
self.a = a
self.b = b
return
def foo_style(self):
return (self.a, self.b)
args is not required to refer to a tuple: >>> foo(*[31,42])
(31, 42)
I can have objects construct parameters conforming to the specifications for a signature: >>> foo(*Thing(3,91).foo_style())
(3, 91)
Consider that a counterexample.Within the function, args is a tuple, as your output demonstrates.
This always bugs me: why is `args` immutable (tuple) but `kwargs` mutable (dict)? In my experience it’s much more common to have to extend or modify `kwargs` rather than `args`, but I would find more natural having an immutable dict for `kwargs`.