Reputation: 71
In Python, why is it that list take more time to create, than a plain variable?
Let's say you create 2 variables:
x = 1
y= [1]
Lets say you these variables millions of times and compare their time to run.
Since all variables in Python are created on the heap, why is that variable y, which is the list, take more time to create than x?
Upvotes: 1
Views: 87
Reputation: 77847
Upvotes: 2