Re: [Python-Dev] Detecting tp_compare / tp_richcompare from Python

2012-11-08 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/08/2012 02:51 PM, Tres Seaver wrote: > On 11/08/2012 12:59 PM, Guido van Rossum wrote: >> In Python, you can write > >> if C.__eq__ == object.__eq__: print('class C does not override >> __eq__') > >> Does that help? > > That works in Python3,

Re: [Python-Dev] Detecting tp_compare / tp_richcompare from Python

2012-11-08 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/08/2012 12:59 PM, Guido van Rossum wrote: > In Python, you can write > > if C.__eq__ == object.__eq__: print('class C does not override > __eq__') > > Does that help? That works in Python3, but not in Python2 -- methodwrappers don't compare eq

Re: [Python-Dev] Detecting tp_compare / tp_richcompare from Python

2012-11-08 Thread Guido van Rossum
In Python, you can write if C.__eq__ == object.__eq__: print('class C does not override __eq__') Does that help? On Thu, Nov 8, 2012 at 9:55 AM, Tres Seaver wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 11/08/2012 12:38 PM, Guido van Rossum wrote: >> Well, the default beha

Re: [Python-Dev] Detecting tp_compare / tp_richcompare from Python

2012-11-08 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/08/2012 12:38 PM, Guido van Rossum wrote: > Well, the default behavior has changed to raise an exception when > using <, <=, >, >=; i.e., inequalities do not have a default > implementation at all. Perhaps that is enough for your purpose? == >

Re: [Python-Dev] Detecting tp_compare / tp_richcompare from Python

2012-11-08 Thread Guido van Rossum
Well, the default behavior has changed to raise an exception when using <, <=, >, >=; i.e., inequalities do not have a default implementation at all. Perhaps that is enough for your purpose? == and != still compare by pointer, but you're primarily interested in ordering her, right? On Thu, Nov 8,

[Python-Dev] Detecting tp_compare / tp_richcompare from Python

2012-11-08 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 While porting the BTrees package (split out from ZODB) to Python3., my first step is to get the pure-Python reference implementation working: in order to do that, I need a way to check that objects used as keys are *not* using the comparison semantics