Ascertain if two objects are equal using numerically tolerant equality where appropiate.
If the first argument (x) has an equals method, then it is used. In this case equals(x,y) is equivalent to x.equals(y).
Parameters: |
|
---|---|
Returns: | True or False. |
Examples
>>> x
<CF Field: rain(10,20)>
>>> cf.equals(x,x)
True
>>> cf.equals(1.0, 1.0)
True
>>> cf.equals(1.0, 33)
False
>>> cf.equals('a', 'a')
True
>>> cf.equals('a', 'b')
False
>>> type(x), x.dtype
(<type 'numpy.ndarray'>, dtype('int64'))
>>> y=x.copy()
>>> cf.equals(x, y)
True
>>> cf.equals(x, x+1)
False
>>> class A(object): pass
>>> a=A()
>>> b=A()
>>> cf.equals(a, a)
True
>>> cf.equals(a, b)
False