A similar (but not the same) question is asked here; this question is about why a casted object's methods don't alter the underlying values and return them to their original variable type.
In Python, you can cast a variable with list(). Why doesn't the following code work as one might expect?
stir = "lolololol"
for i in range(11):
if i % 2:
list(stir).insert(i, ":")
I would expect "stir" to be casted a list, the .insert() method called, the original variable's value modified as if it were a list, then returned to the variable type it was before. Instead I get no changes.
Setting the output to a new variable also produces Nonetype:
x = list(stir).insert(0, ":")
print x