Thanks for all the input! I don't know if I agree that it's a slippery slope, since copysign seems to me of a different nature compared to e.g. sin.
How important to use this: Many languages do feature a sign function, if that's of any worth. copysign is python's closest built-in equivalent. I did realise this is probably a bit of an X/Y problem. I gave the example of range, where int values are required. I was using it like this: range(start, end, sign(end-start)), to automatically have a range going up or down. But that's really the only concrete case I know. So then it might really come down to range not accepting floats, which I think is an old topic. On Fri, 29 Nov 2019 at 17:58, Christopher Barker <python...@gmail.com> wrote: > On Fri, Nov 29, 2019 at 8:30 AM Brandt Bucher <brandtbuc...@gmail.com> > wrote: > >> Yep. It’s also the only way that I know of to get the sign of a NaN. We >> can’t even parse the repr for that! >> > > Exactly -- while a tiny bit handy for ints, floats are where it is really > *needed*. > > And back to Guido's point -- while called "math", the math module really > is a "float_math" module. It began as a wrapper around the C math library, > and while it has grown a number of Python specific functions, I'm pretty > sure all the ones that reflect C math functions are essentially unchanged, > and it should probably stay that way. > > -CHB > > > -- > Christopher Barker, PhD > > Python Language Consulting > - Teaching > - Scientific Software Development > - Desktop GUI and Web Development > - wxPython, numpy, scipy, Cython > _______________________________________________ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/HGRTJR75V6JW2JZB2PEPW2TPKEB4MSRY/ > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/CIAI66J2XW45W52F7SESNAXQB3FMHVEP/ Code of Conduct: http://python.org/psf/codeofconduct/