Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How can I distinguish between Sage and Python?

Is there a constant defined in SageMath that I can use to distinguish whether Sage is running or pure Python? Something that I can use like this:

SAGE = False
try:
    SAGE = ZZ
except NameError:
    pass
print(SAGE)

Contrary to my expectations, the Sage Cell Server outputs 'Integer Ring' in both cases.