def __setitem__(self, key, value):
        """Set value on key and update the flat values set.

        key (any hashable python object)
            object used as dictionary key.
        value (any python object)
            object to be mapped to the key object.

        Extends dict.__setitem__.

        ### Alternative implementation

        As can be seen in the method body, the method is
        divided into three operations:

        1) delete item corresponding to key if existent
        2) use dict.__setitem__ to set the new value for
           the key
        3) store the new value(s) in the flat_value list

        Such operations can alternatively be reduced to two
        operations, if so desired:

        1) use dict.__setitem__ to set the new value for
           the key (same as number (2) above)
        2) clearing and repopulating the flat values, which
           can be done by simply executing the "update"
           method without arguments (it happens as a
           side-effect).

        But we decide against it because depending on the
        size of both this class instance and the new value
        being set just removing items from current value
        (current step (1)) and storing items from new value
        (current step (3)) may be quicker.
        """
        ### delete the current item on the key, if existent;
        ### this is done because by deleting it we ensure
        ### the value (or nested values within it) are all
        ### properly removed from the flat values list
        ### before assigning the new value(s) to the list
        ### in a further step;

        try:
            del self[key]
        except KeyError:
            pass

        ### use the builtin dict.__setitem__ method
        super().__setitem__(key, value)

        ### finally store the new value(s) on the
        ### flat values list depending on whether it
        ### is a mapping or not

        ## store the new value in the flat_values list
        ## if it is not a mapping

        if not isinstance(value, Mapping):
            self._bound_append(value)

        ## otherwise store its nested values instead

        else:
            nested_values = flatten_mapping_values(value)
            self._bound_extend(nested_values)
Set value on key and update the flat values set.

        key (any hashable python object)
            object used as dictionary key.
        value (any python object)
            object to be mapped to the key object.

        Extends dict.__setitem__.

        ### Alternative implementation

        As can be seen in the method body, the method is
        divided into three operations:

        1) delete item corresponding to key if existent
        2) use dict.__setitem__ to set the new value for
           the key
        3) store the new value(s) in the flat_value list

        Such operations can alternatively be reduced to two
        operations, if so desired:

        1) use dict.__setitem__ to set the new value for
           the key (same as number (2) above)
        2) clearing and repopulating the flat values, which
           can be done by simply executing the "update"
           method without arguments (it happens as a
           side-effect).

        But we decide against it because depending on the
        size of both this class instance and the new value
        being set just removing items from current value
        (current step (1)) and storing items from new value
        (current step (3)) may be quicker.
        
nodezator/ourstdlibs/collections/fldict/main.py