True if and only if two objects are logically equal.
If the first argument, x, has an equals method then it is used, and in this case equals(x, y) is equivalent to x.equals(y). Else if the second argument, y, has an equals method then it is used, and in this case equals(x, y) is equivalent to y.equals(x).
Parameters: |
|
---|---|
Returns: |
|
Examples: |
>>> f
<CF Field: rainfall_rate(latitude(10), longitude(20)) kg m2 s-1>
>>> cf.equals(f, f)
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