This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Appending to a large list flushes old entries
Type: behavior Stage:
Components: Versions: Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Swaprava Nath
Priority: normal Keywords:

Created on 2016-03-31 02:49 by Swaprava Nath, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg262683 - (view) Author: Swaprava Nath (Swaprava Nath) Date: 2016-03-31 02:49
I'm storing several variables in a list after a computation in a for loop. I'm bundling the variables in a tuple and appending this tuple to a list. So, the structure should be:

iter 1: list = [tuple1]
iter 2: list = [tuple1, tuple2]
iter 3: list = [tuple1, tuple2, tuple3] etc.

and the tuple has dissimilar objects. Surprisingly, I see that the list grows until a point and then suddenly all old entries are flushed out and new tuple_n is the only entry

iter n: list = [tuple_n]

Is this a bug? Or is there a cap on the size of the list?
msg262685 - (view) Author: Swaprava Nath (Swaprava Nath) Date: 2016-03-31 02:57
I realised that this is a normal behavior, I just had two for loops, nested, and every time the inner for loop runs, the list flushes. No worries, sorry!
History
Date User Action Args
2022-04-11 14:58:29adminsetgithub: 70862
2016-03-31 02:58:16Swaprava Nathsetstatus: open -> closed
2016-03-31 02:57:51Swaprava Nathsetresolution: not a bug
messages: + msg262685
2016-03-31 02:56:18Swaprava Nathsetfiles: - knapsack.py
2016-03-31 02:49:57Swaprava Nathcreate