In python strings are immutable, that means you can’t change it after creation. When
you for example concatenate two strings a new one is created, so there is no way
to change the default parameter string.

But what happens if you use an empty list as the default parameter? I
expected to always get an empty list.

A list is mutable, that means you can add or change elements in the list. And
you get passed the same list instance each time on a call to append_one, as
variables are passed by reference in python. So this behaviour is actually not
that surprising. The same is the case for each other mutable class you pass as a
default argument.

But how can you use a mutable object?

There are several ways, but I like the following.

Instead of passing the object directly, we pass None and check for it in the function.