Step one: rebind the list to a different name
lst = list
Step two: delete the list
variable
del list
Step three: don't do it again
I prefer this over __builtins__.list
simply because it saves the typing, and you aren't still left with a variable named list
. However, it is always best to avoid the problem altogether. When writing production code, always remember not to have variables named the same as built in functions.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…