good __eq__, __lt__, ..., __hash__ methods for image class?
<p>I create the following class:</p>

<pre><code>class Image(object):
    def __init__(self, extension, data, urls=None, user_data=None):
        self._extension = extension
        self._data = data
        self._urls = urls
        self._user_data = user_data
        self._hex_digest = hashlib.sha1(self._data).hexDigest()
</code></pre>

<p>Images should be equal when all values are equal. Therefore I wrote:</p>

<pre><code>    def __eq__(self, other):
        if isinstance(other, Image) and self.__dict__ == other.__dict__:
            return True
        return False

    def __ne__(self, other):
        return not self.__eq__(other)

    def __lt__(self, other):
        return self.__dict__ &lt; other.__dict__
    ...
</code></pre>

<p>But how should the <code>__hash__</code> method look like? Equal Images should return equal hashes...</p>

<pre><code>    def __hash__(self):
        # won't work !?!  
        return hash(self.__dict__)
</code></pre>

<p>Is the way I try to use <code>__eq__, __ne__, __lt__, __hash__, ...</code> recommend?</p>
