Is there any reason to do anything more complicated than one of these two lines when you want to clear a list in Python?
old_list = []
old_list = list()
The reason I ask is that I just saw this in some running code:
del old_list[ 0:len(old_list) ]
a[:x]means beginning to x anda[x:]means x to end.a[ 0:len(a) ]can be written asa[:]. You can also use negatives to count from the end (a[-1]is the last element). - idbrii