On Mar 3, 12:42 am, Aaron Brady <castiro...@gmail.com> wrote: > On Mar 2, 9:24 pm, Terry Reedy <tjre...@udel.edu> wrote: > > > > > Gabriel Genellina wrote: > > > En Mon, 02 Mar 2009 17:54:09 -0200, Terry Reedy <tjre...@udel.edu> > > > escribió: > > > >> Aaron Brady wrote: > > >>> Hi, > > >>> In the source for 3.0.1, PyObject_RichCompareBool seems to perform an > > >>> extra check on identity that PyObjecct_RichCompare does not perform. > > > >> To me, the existence of two functions suggests that they are > > >> *intended* to act differently. > > > > Mmm, but then the documentation is misleading and incomplete, at least. > > > PyObject_RichCompareBool is not equivalent of "o1 op o2" as it claims, > > > and both functions differ in more than return value (the only documented > > > difference). > > > Could be. I believe the C API docs have had must less testing by naive > > users than the Python docs, and even those are not quite perfect yet. > > RichCompareBool is used 62 times in the source, minus declaration. > It's partly (by eye) used to test identity with Py_EQ. Then there > should be a different function, more like "IdCompareBool". > > Duncan stated: > > > Without looking at the code it sounds like a bug: identity doesn't always > > imply equality. > > In such cases, should "a in [a]" be True or False? > > Abstract example: > > >>> class A: > > ... def __eq__( self, oth ): > ... if self is oth: > ... return False > ... return object.__eq__( self, oth ) > ...>>> a= A() > >>> a==a > False > >>> [a]==[a] > > True > > 'list' does seem to break its contract. ...
Hi. Just bringing it up again. I feel the docs should mention it at least, and there should possibly be a separate function. -- http://mail.python.org/mailman/listinfo/python-list