Does dictionary's clear() method delete all the item related objects from memory?

后端 未结 7 1573
梦毁少年i
梦毁少年i 2020-12-23 17:26

If a dictionary contains mutable objects or objects of custom classes (say a queryset, or a even a DateTime), then will calling clear() on the dictionary delet

7条回答
  •  無奈伤痛
    2020-12-23 17:42

    the del command delete the reference of the particular item in the list, the clear command clear all the key value pairs in a go so the functionality is same they both dereference and rest task of removing it from memory is done by the garbage collector

提交回复
热议问题