In func
when you do del data[:]
you delete the object that the local argument data
is pointing to. So even though you've stored a reference to it in the database it's gone.
You can either:
- remove the delete statement, local variables will be discarded anyways, there is no need for this
- Use
database[x][y]=list(data)
instead to make a copy of data as a new object