[cfe-users] __hash__ in cindex.py Cursor class?
Sebastian
sebastianspublicaddress at googlemail.com
Sun Sep 1 04:00:40 PDT 2013
Hi,
the Cursor class has a hash property, but no __hash__ method.
Is this because the Cursor class is not "hashable" (immutable, objects which compare equal must have the same hash value)?
Currently, I'm using this wrapper class, which seems to work:
class HashedCursor:
def __init__(self, cursor):
self.cursor = cursor
def __eq__(self, other):
return self.cursor == other.cursor
def __hash__(self):
return self.cursor.hash
regards,
Sebastian
More information about the cfe-users
mailing list