The reason is in Python, the complex function seems redefined. They always use the integral zero in the imagine part. It is not changed even under the product with a float number. The power function is also redefined.
In [24]: cmath.log(complex(-.2, -0.0j))
Out[24]: (-1.6094379124341003-3.141592653589793j)
In [25]: cmath.log(complex(-.2, 0.0j))
Out[25]: (-1.6094379124341003+3.141592653589793j)
Iām not sure I would call the behavior more sensible though:
In [31]: -complex(.25)
Out[31]: (-0.25-0j)
In [32]: (-1)*complex(.25)
Out[32]: (-0.25+0j)
(and therefore a different sign in the imaginary part of the log). Iām guessing this is because (-1)*complex(.25) promotes the -1 to a complex number, which possibly changes the sign of the zero sign. In any case: signed zeros are a mess, and it looks like julia is more consistent here.
The āzero ringā is unfortunately not integral. (I was very disappointed when I found out.) For example, there is 0 / 0 = 0, or 0 * x = x. Thus ZeroElem is a subtype of Number, but not a subtype of Integer.
One could define a type Int0, and integer type with 0 bits, similar to how Julia interprets Bool very similar to Int. But that would be very similar to defining a constant trueZero that gets promoted to the various zeros in the various Number types. I donāt think that would be useful as part of the language standard.