'Delete an HDU from the `HDUList`, indexed by number or name.'

def __delitem__(self, key):

    if isinstance(key, slice):
        end_index = len(self)
    else:
        key = self._positive_index_of(key)
        end_index = (len(self) - 1)
    self._try_while_unread_hdus(super(HDUList, self).__delitem__, key)
    if ((key == end_index) or ((key == (-1)) and (not self._resize))):
        self._truncate = True
    else:
        self._truncate = False
        self._resize = True
