differences between "d.clear()" and "d={}"
- by Tshepang
On my machine, the execution speed between "d.clear()" and "d={}" is over 100ns so am curious why one would use one over the other.
import timeit
def timing():
d = dict()
if __name__=='__main__':
t = timeit.Timer('timing()', 'from __main__ import timing')
print t.repeat()