pyorient icon indicating copy to clipboard operation
pyorient copied to clipboard

OrientRecord - __eq__(), __cmp__() and __hash__() methods

Open devspacenine opened this issue 9 years ago • 2 comments

It would be nice if the OrientRecord class had __eq__(), __cmp__() and __hash__() methods so that we can check for the existence of a RID in a list of OrientRecords.

if '#12:0' in records:
     print('Got here')

Thoughts?

devspacenine avatar Nov 23 '15 15:11 devspacenine

Would also be pretty useful to have __contains__ and a lot of the other container methods. That way we can do things like check for a field in a record.

if 'test_field' in record:
    print(record.test_field)

devspacenine avatar Nov 24 '15 14:11 devspacenine

Yo, in some recent develop branch commits, I've added various container methods to OrientRecord.

Left out the various ordering operations suggested across python 2/3 ... not convinced there's meaningful ordering for records.

TropicalPenguin avatar Jul 27 '17 10:07 TropicalPenguin