a = [[ for col in range(4)] for row in range(4)]
I do that code and it runs fine, and then I manipulate that list with code I have later and it runs fine at a reasonable speed.
But if I put this code in a module.
def make(x,y,content): list = [[content for col in range(x)] for row in range(y)] return list
Module that I'm working in
b = ListToFillUp.make(4, 4, )
And then I import the module into the other module and use this line to make the list, it is fine and it is identical to the other list as checked by ==, but it encounters code later on that it just hangs on until I have a memory error.
There could be a problem with the code later on that I didn't post, but the bigger problem is how there seems to be an actual difference between the lists created. But when I compare the two lists with == it comes up as true. And I see the lists printed out and they are the same. I even do "copy.deepcopy(b)" and the problem still exists. So is there anything else I can check to see if they are different or if there is another explanation why I am getting a memory error?
Edited 5 Years Ago by Peacer: n/a