Message326441
Thanks Serhiy, I read the Python-Dev thread you linked to, but that doesn't resolve the issues:
- Its topic is Python 2.6 (where this behavior does not occur) rather than Python 3 (where it does).
- A few messages into the thread Guido does address Python 3, but in fact says "I think the consensus is against round-to-even in 3.0" (see https://mail.python.org/pipermail/python-dev/2008-January/075897.html).
- There is no discussion of the fact that this behavior differs from the function named "round" in all the other programming languages I mentioned, and whether it would therefore be better exposed as an additional function (e.g. "round_to_even" or "round_unbiased", and in the math or statistics package rather than builtins). Surprisingly, Excel is the only other programming environment I saw discussed in the thread. (And round(2.5) == 3 there.)
So that all suggests there must be some other thread or issue where this change for Python 3 have been discussed, but I looked again and could not find it.
The C "rint" example you gave just seems to prove the point that this behavior should have a distinct name from "round".
Regarding:
> It is a common knowledge that rounding half-to-even is what users want in most cases
I don't think that's common knowledge; seems like citation needed? Based on all the other languages where this differs (not to mention Python 2), it's not clear users would want Python 3 to be the only different one. And this is definitely a surprise for the majority of programmers, whose experience with "round" is how it works everywhere else. (This is making it into pywat after all: https://github.com/cosmologicon/pywat/pull/40)
I can submit a PR for at least updating the docs about this (as per my previous comment) if that would be welcomed. |
|
Date |
User |
Action |
Args |
2018-09-26 11:09:30 | jab | set | recipients:
+ jab, mark.dickinson, jyasskin, ezio.melotti, serhiy.storchaka, MJH |
2018-09-26 11:09:30 | jab | set | messageid: <1537960170.25.0.545547206417.issue32956@psf.upfronthosting.co.za> |
2018-09-26 11:09:30 | jab | link | issue32956 messages |
2018-09-26 11:09:30 | jab | create | |
|