On 10/29/07, Greg Ewing <[EMAIL PROTECTED]> wrote: > Adam Olsen wrote: > > It's not clear to me how many distinct operations you'd need though, > > or how acceptable reflections would be. > > My intention was just to directly expose the tp_richcmp > slot, so there would be six. > > To make things easier in the common case, there could > perhaps be a utility function that would take a comparison > operation code and a -1, 0, 1 value and return the > appropriate boolean. Then a __richcmp__ method could be > written very similarly to the way a __cmp__ method is > now. It might even be possible for 2to3 to convert > __cmp__ methods to __richcmp__ methods automatically.
It'd be simpler still if we only had __cmp__ and __eq__. I just don't understand the use cases where that's not sufficient. Hrm. I guess set's subset checking requires more relationships than __cmp__ provides. Abandoning that feature probably isn't an option, so nevermind me. (Although, if we really wanted we could use -2/+2 to mean subset/superset, while -1/+1 mean smaller/larger.) -- Adam Olsen, aka Rhamphoryncus _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com