Great : implementing __hash__ *and* operator==() did the trick !
My implementation uses this
int hello::__hash__() const
{
//Using Duff's device version of sdbm hash func
return dbm_hash(country.c_str(), country.length());
}
bool hello::operator == (const hello &h) const {
return __hash__() == h.__hash__();
}
With the corresponding definitions for my extension
class_<hello>("hello", init<std::string>())
.def("__hash__", &hello::__hash__)
.def(self == self)
;
Thank you,
--
Guillaume
_______________________________________________
Cplusplus-sig mailing list
[email protected]
http://mail.python.org/mailman/listinfo/cplusplus-sig