def __setitem__(self, key, data):
    "Set a slice of Entries.\n\n        @param key: index or range of Entry numbers to set\n        @type key: slice or int\n        @param data: the data to set these entries to. Normally each entry should\n        be a sequence; if a scalar is provided, it is treated\n        as a single-element list.\n        @type data: scalar or list\n        @raise ValueError: if size of {data} does not match size of L{key}\n        @note: Attributes do not 'grow' or 'shrink' as entries are added\n               or removed. Indexes of entries never change and there is no\n               way to 'insert'.\n        "
    if (key is Ellipsis):
        key = slice(None, None, None)
    if (not hasattr(key, 'indices')):
        idx = (key, (key + 1), 1)
        data = [data]
    else:
        idx = key.indices((self.max_idx() + 1))
        if ((key.step is None) or (key.step > 0)):
            if (len(data) > len(range(*idx))):
                idx = (idx[0], (idx[0] + (idx[2] * len(data))), idx[2])
    data_idx = (- 1)
    typelist = []
    for i in range(*idx):
        data_idx += 1
        if (data_idx >= len(data)):
            continue
        datum = data[data_idx]
        if (datum is None):
            typelist[i] = (None, None, None)
            continue
        (dims, types, elements) = _Hyperslice.types(datum, backward=self._cdf_file.backward)
        if (len(types) <= 0):
            raise ValueError('Cannot find a matching CDF type.')
        if (len(dims) > 1):
            raise ValueError('Entries must be scalar or 1D.')
        elif ((len(dims) == 1) and isinstance(datum[0], str_classes)):
            raise ValueError('Entry strings must be scalar.')
        entry_type = None
        if self.has_entry(i):
            entry_type = self.type(i)
            if (not (entry_type in types)):
                entry_type = None
        if (entry_type is None):
            entry_type = self._check_other_entries(types)
        if ((entry_type is None) and (self.ENTRY_ == const.zENTRY_)):
            vartype = self._cdf_file[i].type()
            if (vartype in types):
                entry_type = vartype
            else:
                entry_type = types[0]
        elif (entry_type is None):
            entry_type = types[0]
        if (not (entry_type in lib.numpytypedict)):
            raise ValueError('Cannot find a matching numpy type.')
        typelist.append((dims, entry_type, elements))
    data_idx = (- 1)
    for i in range(*idx):
        data_idx += 1
        if ((data_idx >= len(data)) or (data[data_idx] is None)):
            if self.has_entry(i):
                del self[i]
            continue
        datum = data[data_idx]
        (dims, entry_type, elements) = typelist[data_idx]
        self._write_entry(i, datum, entry_type, dims, elements)
Set a slice of Entries.

@param key: index or range of Entry numbers to set
@type key: slice or int
@param data: the data to set these entries to. Normally each entry should
be a sequence; if a scalar is provided, it is treated
as a single-element list.
@type data: scalar or list
@raise ValueError: if size of {data} does not match size of L{key}
@note: Attributes do not 'grow' or 'shrink' as entries are added
       or removed. Indexes of entries never change and there is no
       way to 'insert'.
def __setitem__(self, key, data):
    "Set a slice of Entries.\n\n        @param key: index or range of Entry numbers to set\n        @type key: slice or int\n        @param data: the data to set these entries to. Normally each entry should\n        be a sequence; if a scalar is provided, it is treated\n        as a single-element list.\n        @type data: scalar or list\n        @raise ValueError: if size of {data} does not match size of L{key}\n        @note: Attributes do not 'grow' or 'shrink' as entries are added\n               or removed. Indexes of entries never change and there is no\n               way to 'insert'.\n        "
    if (key is Ellipsis):
        key = slice(None, None, None)
    if (not hasattr(key, 'indices')):
        idx = (key, (key + 1), 1)
        data = [data]
    else:
        idx = key.indices((self.max_idx() + 1))
        if ((key.step is None) or (key.step > 0)):
            if (len(data) > len(range(*idx))):
                idx = (idx[0], (idx[0] + (idx[2] * len(data))), idx[2])
    data_idx = (- 1)
    typelist = []
    for i in range(*idx):
        data_idx += 1
        if (data_idx >= len(data)):
            continue
        datum = data[data_idx]
        if (datum is None):
            typelist[i] = (None, None, None)
            continue
        (dims, types, elements) = _Hyperslice.types(datum, backward=self._cdf_file.backward)
        if (len(types) <= 0):
            raise ValueError('Cannot find a matching CDF type.')
        if (len(dims) > 1):
            raise ValueError('Entries must be scalar or 1D.')
        elif ((len(dims) == 1) and isinstance(datum[0], str_classes)):
            raise ValueError('Entry strings must be scalar.')
        entry_type = None
        if self.has_entry(i):
            entry_type = self.type(i)
            if (not (entry_type in types)):
                entry_type = None
        if (entry_type is None):
            entry_type = self._check_other_entries(types)
        if ((entry_type is None) and (self.ENTRY_ == const.zENTRY_)):
            vartype = self._cdf_file[i].type()
            if (vartype in types):
                entry_type = vartype
            else:
                entry_type = types[0]
        elif (entry_type is None):
            entry_type = types[0]
        if (not (entry_type in lib.numpytypedict)):
            raise ValueError('Cannot find a matching numpy type.')
        typelist.append((dims, entry_type, elements))
    data_idx = (- 1)
    for i in range(*idx):
        data_idx += 1
        if ((data_idx >= len(data)) or (data[data_idx] is None)):
            if self.has_entry(i):
                del self[i]
            continue
        datum = data[data_idx]
        (dims, entry_type, elements) = typelist[data_idx]
        self._write_entry(i, datum, entry_type, dims, elements)