Why do two identical lists have a different memory footprint?
I created two lists l1 and l2 , but each one with a different creation method: import sys l1 = [None] * 10 l2 = [None for _ in range(10)] print('Size of l1 =', sys.getsizeof(l1)) print('Size of l2 =', sys.getsizeof(l2)) But the output surprised me: Size of l1 = 144 Size of l2 = 192 The list created with a list comprehension is a bigger size in memory, but the two lists are identical in Python otherwise. Why is that? Is this some CPython internal thing, or some other explanation? When you write [None] * 10 , Python knows that it will need a list of exactly 10 objects, so it allocates exactly