def update(self, *args, **kw):
        '''
        Update the dictionary with items and names::

            (items, names, **kw)
            (dict, names, **kw)
            (MIDict, names, **kw)

        Optional positional argument ``names`` is only allowed when ``self.indices``
        is empty (no indices are set yet).
        '''
        if len(args) > 1 and self.indices:
            raise ValueError('Only one positional argument is allowed when the'
                             'index names are already set.')

        if not self.indices:  # empty; init again
            _MI_init(self, *args, **kw)
            return

        d = MIMapping(*args, **kw)
        if not d.indices:
            return

        names = force_list(self.indices.keys())

        if len(d.indices) != len(names):
            raise ValueError('Length of update items (%s) does not match '
                             'length of original items (%s)' %
                             (len(d.indices), len(names)))

        for key in d:
            # use __setitem__() to handle duplicate
            self[key] = d[key]