Directly Overloading ==

Andrew Dalke dalke at acm.org
Wed Sep 13 11:04:54 EDT 2000


Alex Martelli wrote:
>This would make the overloaded == completely unusable
>in all existing contexts, that expect it to return a
>value directly usable as true/false.

No it wouldn't.  The current code checks that the result
of __cmp__ is an integer.  To support Terry's request, it
could check if the object has an __int__ coercion, and use
the result of that for comparison.

                    Andrew
                    dalke at acm.org






More information about the Python-list mailing list