
Quite a funny thing. It turned out that the Python works in the complex plane by default. Therefore when you are trying to take a cube root of a negative number ** operator thinks in complex plane in terms of argument and magnitude. The magnitude is 8 and its root is 2 - no surprise. The argument is 180 degrees, operator divides it by three and gives . Real and imaginary parts are:

To avoid this surprise you can use

This function honestly looks for a real number whose cube is -8.