Skip to content

Instantly share code, notes, and snippets.

View Adirio's full-sized avatar
🎓
PhD Student

Adrián Adirio

🎓
PhD Student
View GitHub Profile
import random
import timeit
t1 = [[random.randint(-100, 100), 0] for n in range(10000)]
t2 = [[random.randint(-100, 100), 0] for n in range(10000)]
print('{:^24} | {:^24}'.format('Dict unpacking', 'List concat'))
for i in range(10):
s1 = timeit.timeit('d = {**dict(t1), **dict(t2)}', number=1000, globals= globals())
s2 = timeit.timeit('d = dict(t1 + t2)', number=1000, globals= globals())