[Python-Dev] Comparison inconsistency with ExtensionClass

Guido van Rossum guido@beopen.com
Thu, 06 Jul 2000 10:32:32 -0500


[JimF]
> Technically, this *is* a bug in ExtensionClass, however, Python
> *does* deserve some of the blame. The intepreter actually uses the
> following rule:
> 
>   Instances of two different "python types" are not compared
>   using type-supplied comparison methods unless:
> 
>   - At least one of the types is InstanceType or
> 
>   - Both of the types are numeric.
> 
> This rule is rather inconvenient for ExtensionClass.
> It's also pretty inconvenient for non-ExtensionClass
> non-numeric extension types that want to be comparable with 
> other things.
> 
> You can work around this by making your ExtensionClass a numeric
> type. This should be possible by providing a numeric method.

Without having investigated all the details of this thread, I suspect
that all of this ought to be rethought when we do rich comparisons and
revamp coercions.  I'd say that would be a good project for Python
2.1...  (Which most of the Zopers probably still know as 1.7. :-)

--Guido van Rossum (home page: http://dinsdale.python.org/~guido/)