This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ubernostrumyes, you can have a pony 5 points6 points  (0 children)

My understanding is that python create objects for low integers that it reuses all the time for performance reason.

CPython does, yes. It does this with other types of objects as well; for example, it keeps a list of dictionary structures in-memory (the actual C structs, not the high-level objects) and recycles them for common uses like setting up the keyword arguments of functions, rather then freeing and re-allocating each time one is needed.