In the delete_node function appended, is it necessary to set cur_node = None at the end? As I can assume, when assigning objects with the = operator it is assigned by reference not by value and putting None in cur_node ensures that no variable references the previously contained object right? So it is memory efficient
def delete_node(self, key):
cur_node = self.head
if cur_node and cur_node.data == key:
self.head = cur_node.next
cur_node = None
return