Ask Your Question

Revision history [back]

Just use == :

sage: import numpy
sage: a = numpy.int64(123) ; a
123
sage: type(a)
<type 'numpy.int64'>
sage: b = ZZ(123) ; b
123
sage: a == b
True
sage: type(b)
<type 'sage.rings.integer.Integer'>
sage: c = ZZ(1234)
sage: a == c
False
sage: A = [[numpy.int64(1), numpy.int64(2)], [numpy.int64(3), numpy.int64(4)]]
sage: B = [[ZZ(1), ZZ(2)], [ZZ(3), ZZ(4)]]
sage: A
[[1, 2], [3, 4]]
sage: B
[[1, 2], [3, 4]]
sage: A == B
True
sage: C = [[ZZ(1), ZZ(2)], [ZZ(3), ZZ(5)]]
sage: A == C
False