Great : implementing __hash__ *and* operator==() did the trick ! <br><br>My implementation uses this<br><div style="margin-left: 40px; font-family: courier new,monospace;">int hello::__hash__() const<br>{<br>    //Using Duff&#39;s device version of sdbm hash func<br>


    return dbm_hash(country.c_str(), country.length());<br>}<br><br>bool hello::operator == (const hello &amp;h) const { <br>    return __hash__() == h.__hash__();<br>}<br></div><br>With the corresponding definitions for my extension<br>


<div style="margin-left: 40px;"><span style="font-family: courier new,monospace;">class_&lt;hello&gt;(&quot;hello&quot;, init&lt;std::string&gt;())</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    .def(&quot;__hash__&quot;, &amp;hello::__hash__)</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">    .def(self == self)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    ;</span><br style="font-family: courier new,monospace;">


</div><br>Thank you,<br><br><br clear="all">--<br>Guillaume<br>