Exponentiation with negative bases typically involves complex numbers, so Python switches to complex numbers when it sees the negative base. Such exponentiation is typically mutlivalued, and Python doesn't always return the value you might expect.
For the special case of the 1/3 power with real bases, you could write a function like this:
def cubeRoot(x):
if x >= 0:
return x**(1/3)
else:
return -(-x)**(1/3)
Which will give the expected real cube root.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…