Ask Your Question

Revision history [back]

I don't know if you actually need symbolic expressions, otherwise tests are very straightforward:

sage: x=12
sage: x in ZZ, x in QQ, x in RR
(True, True, True)

Note that tests using pure Python isinstance give different output, no surprise:

sage: isinstance(x, Integer), isinstance(x, ZZ)
(True, False)