def __init__(self, mapping_or_iterable=None, **kwargs):
        """ Initializes dictionary from an optional positional argument and a possibly empty set of keyword arguments."""
        self.items_dict = {}
        if mapping_or_iterable is not None:
            if type(mapping_or_iterable) is dict:
                mapping_or_iterable = mapping_or_iterable.items()
            for kv in mapping_or_iterable:
                if len(kv) != 2:
                    raise Exception('Iterable should contain tuples with exactly two values but specified: {0}.'.format(kv))
                self[kv[0]] = kv[1]
        for keys, value in kwargs.items():
            self[keys] = value
def __init__ ( self , mapping_or_iterable = None , ** kwargs ) : self . items_dict = { } if mapping_or_iterable is not None : if type ( mapping_or_iterable ) is dict : mapping_or_iterable = mapping_or_iterable . items ( ) for kv in mapping_or_iterable : if len ( kv ) != 2 : raise Exception ( 'Iterable should contain tuples with exactly two values but specified: {0}.' . format ( kv ) ) self [ kv [ 0 ] ] = kv [ 1 ] for keys , value in kwargs . items ( ) : self [ keys ] = value
Initializes dictionary from an optional positional argument and a possibly empty set of keyword arguments.