There is no memory limit imposed by Python. However, you will get a MemoryError
if you run out of RAM. You say you have 20301 elements in the list
. This seems too small to cause a memory error for simple data types (e.g. int
), but if each element itself is an object that takes up a lot of memory, you may well be running out of memory.
The IndexError
however is probably caused because your ListTemp
has got only 19767 elements (indexed 0 to 19766), and you are trying to access past the last element.
It is hard to say what you can do to avoid hitting the limit without knowing exactly what it is that you are trying to do. Using numpy
might help. It looks like you are storing a huge amount of data. It may be that you don't need to store all of it at every stage. But it is impossible to say without knowing.