'best way to clear a list in Python performance-wise
I am interested to know, if there is any performance difference between the two following ways of clearing a python list: and if one of them is considered to be a better "best-practice"
my_list = [1, 2, 3]
# method 1
my_list.clear()
# method 2
del my_list[:]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
