Re: [Pyobjc-dev] Pure python instance -> ObjC proxy incomplete?
Brought to you by:
ronaldoussoren
From: Ronald O. <ous...@ci...> - 2003-10-15 18:37:57
|
On 15 okt 2003, at 19:30, b.bum wrote: > > In looking at OC_PythonObject.[hm], it would appear that it doesn't > implement all of the NSObject protocol. > > In particular, we are missing.... > > - (BOOL)isEqual:(id)object; > - (unsigned)hash; > > .... which is causing a bit of consternation when using mechanisms > that attempt to sort collections of objects contained in ObjC > collections. > > It would appear that isEqual: could be forwarded to the __eq__() > method on the Python side, but only if the object passed in is non-nil > and also an instance of OC_PythonObject? isEqual should use 'PyTypeObject.richcmp' (e.g. __eq__) if that is available and 'PyTypeObject.cmp' (__cmp__) otherwise. hash should use PyObject_Hash. Ronald |