def change_item(self, old, new): """ Replace the item 'old' with the 'new'. """ ItemList.change_item(self, old, new) old.menu = None new.menu = weakref(self)