How do you implement __delitem__ when subclassing collections.MutableSequence?
<p>Using Alex Martelli's guidance to use collections.MutableSequence instead of subclassing list() (using Python 2.6.6)</p>

<p>Alex suggested using</p>

<pre><code>class HostList(collections.MutableSequence):
    """A container for manipulating lists of hosts"""
    def __init__(self):
        """Initialize the class"""
        self.list = list()
</code></pre>

<p>I <em>must</em> implement <code>__delitem__</code>, or MutableSequence gets cranky...</p>

<pre><code>&gt;&gt;&gt; import HostList as H
&gt;&gt;&gt; foo = H.HostList()
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
TypeError: Can't instantiate abstract class HostList with abstract methods __delitem__
&gt;&gt;&gt; 
</code></pre>

<p>I have also tried to build <code>__delitem__</code> with <code>return del(ii)</code> and <code>return self.list.remove(ii)</code>... but none of those worked.  What is the right way to declare <code>__delitem__</code> in this context?</p>

<p><strong>EDIT: The final resolution was doing this</strong></p>

<pre><code>    def __delitem__(self, ii):
        """Delete an item"""
        del self.list[ii]    # Thank you @Thomas for the pointer about .remove()
        return
</code></pre>
