def __setitem__(self, key, val):
        """d[key] = val

        Set d[key] to val. Setting keys commits changes to disk, although the
        changes may not be visible until the kernel schedules the write.

        Unlike d[key], this method does not support assigning multiple values
        at once. To set multiple values at once, use the `update` method.

        Parameters
        ----------
        key : int_like
        val : int_like

        Returns
        -------
        val : int
            The value set

        Notes
        -----
        .. versionadded:: 1.1

        .. note::
            Since version 1.6, KeyError is appropriately raised on key misses,
            whereas ``IndexError`` was raised before. This is an old bug, since
            header types were documented to be dict-like. If you rely on
            catching key-miss errors in your code, you might want to handle
            both ``IndexError`` and ``KeyError`` for multi-version robustness.

        .. warning::
            segyio considers reads/writes full headers, not individual fields,
            and does the read from disk when this class is constructed. If the
            file is updated through some other handle, including a secondary
            access via `f.header`, this cache might be out-of-date. That means
            writing an individual field will write the full header to disk,
            possibly overwriting previously set values.

        Examples
        --------
        Set a value and keep in a variable:

        >>> x = header[189] = 5
        >>> x
        5
        """

        self.putfield(self.buf, key, val)
        self.flush()

        return val
def __setitem__ ( self , key , val ) : self . putfield ( self . buf , key , val ) self . flush ( ) return val
d[key] = val

        Set d[key] to val. Setting keys commits changes to disk, although the
        changes may not be visible until the kernel schedules the write.

        Unlike d[key], this method does not support assigning multiple values
        at once. To set multiple values at once, use the `update` method.

        Parameters
        ----------
        key : int_like
        val : int_like

        Returns
        -------
        val : int
            The value set

        Notes
        -----
        .. versionadded:: 1.1

        .. note::
            Since version 1.6, KeyError is appropriately raised on key misses,
            whereas ``IndexError`` was raised before. This is an old bug, since
            header types were documented to be dict-like. If you rely on
            catching key-miss errors in your code, you might want to handle
            both ``IndexError`` and ``KeyError`` for multi-version robustness.

        .. warning::
            segyio considers reads/writes full headers, not individual fields,
            and does the read from disk when this class is constructed. If the
            file is updated through some other handle, including a secondary
            access via `f.header`, this cache might be out-of-date. That means
            writing an individual field will write the full header to disk,
            possibly overwriting previously set values.

        Examples
        --------
        Set a value and keep in a variable:

        >>> x = header[189] = 5
        >>> x
        5