logo       

Overloading !=: msg#00027

lang.jython.user

Subject: Overloading !=

Hi,

I've implemented __eq__() and __not__():
so how come I can't evaluate != operator in Jython?

public class CurveData
{
<...>
public CurveData __eq__(Object obj)
{
return MathsAPI.eq(this,obj);
}
public CurveData __not__()
{
return MathsAPI.not(this);
}
}

Here's an example:

>>> cd1 = CurveData(1,5,10)
>>> cd2 = CurveData(2,5,9)
>>> cd3 = cd1 == cd2
>>> print cd3.getDataAsString()
(0, 1, 0)
>>> cd3 = cd1 != cd2
>>> print cd3.getDataAsString() #Expect (1, 0, 1)
Traceback (innermost last):
File "Q:\scripts\py\API Tests\test3.py", line 79, in ?
AttributeError: 'int' object has no attribute 'getDataAsString'
>>>

Any help/suggestions appreciated :-)

Ant


-------------------------------------------------------
This SF.NET email is sponsored by: FREE SSL Guide from Thawte
are you planning your Web Server Security? Click here to get a FREE
Thawte SSL guide and find the answers to all your SSL security issues.
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise