For Python specifically, I'd add:
Type checking with mypy is a good way to accomplish the "unsafe/safe" string case without having to pollute the variable names. It's a really good use of types in a language that will let you blast through them if you want.
There's something to be said for writing code that is "obviously correct". List/dict/set comprehensions are super underrated for this.
x = [str(y) for y in my_list if y > 5 and y not in other_list]
You can look at that and know it's correct. Versus: x = []
for y in my_list:
if y not in other_list and y > 5:
x.append(y)
Easy enough to check in this case but it requires checking 4-5 different common mistakes (is x initialized, append vs. extend). Also I got so caught up writing the loop I forgot the point was to cast y to a str.