I am trying to make a list with 2 raised to 30 elements but am getting a memory error. Why so? Is it outside the maximum limit of a list in python?
m=[None]*(2**
You are trying to create a huge list here and you do not have enough free RAM to do this. How much RAM will you need?
It will be approximately 8Gb on my machine. You can find the size of None on your machine:
import sys
sys.getsizeof(None) # 16 here
But for a list you can approximate it this way:
sys.getsizeof([None] * (2**20)) # 8388680
and hoping that for 2**30
it will take approximately 2**10
times more you will end up with 8388680 * 2**10
which is approximately 8Gb.