1

i am not able to get the proper usage of double underscore in python.

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

class MappingSubclass(Mapping):

    def update(self, keys, values):
        # provides new signature for update()
        # but does not break __init__()
        for item in zip(keys, values):
            self.items_list.append(item)
Blckknght
  • 100,903
  • 11
  • 120
  • 169
  • 1
    Also used for [magic methods](http://www.rafekettler.com/magicmethods.html) – Greg Sep 25 '13 at 07:29
  • read this http://stackoverflow.com/questions/3443043/why-does-python-use-two-underscores-for-certain-things – DevC Sep 25 '13 at 07:55

0 Answers0