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.
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/OD5EVP3KAQWZ7W72U4HZI22OOSQOPDO4/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to