I have the following code where I reassign a list of several GBs:
res = self.dict_cursor.fetchall()
res_with_offers = []
# we add in HDBUY, SDBUY for now -- HARDCODED
for item in res:
for avail_code in ['HDBUY', 'SDBUY']:
_item = deepcopy(item)
_item['avail_code'] = avail_code
res_with_offers.append(_item)
del res; # <== is this line needed?
res = res_with_offers
My understanding is that the del res;
, as the variable reassignment on the line below it would delete the initial res
item in memory. Is this correct? Why or why not?