On Tue, Jan 09, 2007, Thomas Wouters wrote:
> On 1/9/07, Aahz <[EMAIL PROTECTED]> wrote:
>>
>>Hey! What's this about __cmp__?!
>
> Python 3.0x (p3yk:53295, Jan 8 2007, 09:32:17)
> [GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>>object.__cmp__
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> AttributeError: type object 'object' has no attribute '__cmp__'
>
> E's dead. Stone dead, miss.
Unfortunately, I haven't set up a checkout of py3k yet, could you please
test what this does:
class CheapCompare:
def __init__(self, value):
self.value = value
def __cmp__(self, other):
x = self.value
y = other.value
if x == y:
return 0
elif x > y:
return 1
else:
return -1
print cmp(CheapCompare(1), CheapCompare(2))
If that doesn't work, I expect there to be some unhappy Numeric people.
OTOH, if that does work, what exactly will you be warning about?
--
Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/
"Plus ca change, plus c'est la meme chose."
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com