I was recently learning how to use random.shuffle in Python and I was surprised to see that the function shuffles the variable in place without returning anything. How is this acheived in the function? Looking at the random library's source code yielded no answer.
How can I write my own function that changes the variable in place without reassignment?
random.shuffledoesn't replace the list with a new list; it changes the list's state.