There is an example of code in Python documentation as follows:
In the last line of code is the comment #private copy of original update(). According to the literature, this is supposed to create a private copy of the update method in the base class in case an update method is created in a sub class.
Does anyone have any insight on the significance of doing this?
Code:
class Mapping: def __init__(self, iterable): self.items_list = [] self.__update(iterable) def update(self, iterable): for item in iterable: self.items_list.append(item) __update = update #private copy of original update () method
Does anyone have any insight on the significance of doing this?