answered 5 years ago
Like this:
sage: expr = x^2 sage: expr.operator() == operator.pow True sage: expr.operands() [x, 2]