edit: When I asked this I did not properly understand the concept of mutable and immutable objects, and the variables that point to them
I just noticed I wasn't getting a return from random.shuffle(). I realised this makes sense as you would logically want to work with the original list unless specified otherwise.
>>> import string
>>> import random
>>> letters = list(string.ascii_lowercase)
>>> print(letters)
['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
>>> rand_alpha = random.shuffle(letters)
>>> print(rand_alpha)
None
>>> print(letters)
['f', 'c', 'n', 'u', 'x', 'y', 'q', 'j', 's', 'v', 'w', 'o', 'p', 'z', 't', 'm', 'k', 'd', 'e', 'a', 'g', 'i', 'h', 'l', 'r', 'b']
This led me to wonder whether altering a list in another scope is something people do (and should be cautious not to do accidentally) or is this something special within the Python standard library?
I checked the code - and did a few searches - but I didn't find anything that made this clearer for me.