(*args, **kwds)
D.update([E, ]**F) -> None.  Update D from mapping/iterable E and F.
            If E present and has a .keys() method, does:     for k in E: D[k] = E[k]
            If E present and lacks .keys() method, does:     for (k, v) in E: D[k] = v
            In either case, this is followed by: for k, v in F.items(): D[k] = v
D.update([E, ]**F) -> None.  Update D from mapping/iterable E and F.
            If E present and has a .keys() method, does:     for k in E: D[k] = E[k]
            If E present and lacks .keys() method, does:     for (k, v) in E: D[k] = v
            In either case, this is followed by: for k, v in F.items(): D[k] = v
D . update ( [ E ] ** F ) - > None . Update D from mapping / iterable E and F . If E present and has a . keys () method does : for k in E : D [ k ] = E [ k ] If E present and lacks . keys () method does : for ( k v ) in E : D [ k ] = v In either case this is followed by : for k v in F . items () : D [ k ] = v
def update(*args, **kwds):
        ''' D.update([E, ]**F) -> None.  Update D from mapping/iterable E and F.
            If E present and has a .keys() method, does:     for k in E: D[k] = E[k]
            If E present and lacks .keys() method, does:     for (k, v) in E: D[k] = v
            In either case, this is followed by: for k, v in F.items(): D[k] = v
        '''
        if len(args) > 2:
            raise TypeError("update() takes at most 2 positional "
                            "arguments ({} given)".format(len(args)))
        elif not args:
            raise TypeError("update() takes at least 1 argument (0 given)")
        self = args[0]
        other = args[1] if len(args) >= 2 else ()

        if isinstance(other, Mapping):
            for key in other:
                self[key] = other[key]
        elif hasattr(other, "keys"):
            for key in other.keys():
                self[key] = other[key]
        else:
            for key, value in other:
                self[key] = value
        for key, value in kwds.items():
            self[key] = value
def update ( * args , * * kwds ) : if len ( args ) > 2 : raise TypeError ( "update() takes at most 2 positional " "arguments ({} given)" . format ( len ( args ) ) ) elif not args : raise TypeError ( "update() takes at least 1 argument (0 given)" ) self = args [ 0 ] other = args [ 1 ] if len ( args ) >= 2 else ( ) if isinstance ( other , Mapping ) : for key in other : self [ key ] = other [ key ] elif hasattr ( other , "keys" ) : for key in other . keys ( ) : self [ key ] = other [ key ] else : for key , value in other : self [ key ] = value for key , value in kwds . items ( ) : self [ key ] = value