The math.copysign(x, y) function always returns a float, even when the given x is an int, i.e. math.copysign(3, -1) gives -3.0. This is documented behaviour, but I find it somewhat surprising given that the name suggests that it only copies a sign, and it's also annoying in situations when an int is strictly needed (i.e. as the step argument to range), requiring an additional cast.

I'm interested to hear whether it might be a good idea to preserve the int/float type of the argument in math.copysign.

I'm interested to hear whether it might be a good idea to preserve the int/float type of the argument in math.copysign.