Why the size of set can be bigger than dict in python?

Viewed 320

Why is the size of a set bigger than that of a dict?

s = set()
d = {}

for i in range(20):
    s.add(i)
    d[i] = 1

    print(f'{i+1}:', s.__sizeof__(), d.__sizeof__())

Output:

...
17: 712 624
18: 712 624
19: 2248 624
20: 2248 624

The 19th result confuses me.

0 Answers
Related