On Wed, Dec 24, 2014 at 4:22 AM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > What happens here is that you time a piece of code to: > > - Build a large list containing 100 million individual int objects. Each int > object has to be allocated at run time, as does the list. Each int object > is about 12 bytes in size.
Note to the OP: since you're using Python 2 you would do better to loop over an xrange object instead of a range. xrange produces an iterator over the desired range without needing to construct a single list containing all of them. They would all still need to be allocated, but not all at once, and memory could be reused.
-- https://mail.python.org/mailman/listinfo/python-list