Message78113
I've been playing around with the newly released Python 3.0, and I'm a
bit confused about the built-in round()-function. To sum it up in a
single example:
Python 3.0 (r30:67503, Dec 7 2008, 04:54:04)
[GCC 4.3.2] on linux2
>>> round(25, -1)
30.0
I had expected the result to be the integer 20, because:
1. The documentation on built-in functions says: "values are rounded to
the closest multiple of 10 to the power minus n; if two multiples are
equally close, rounding is done toward the even choice"
2. Both help(round) and the documentation on built-in functions claim
that, if two arguments are given, the return value will be of the same
type as the first argument.
Is this unintended behaviour, or am I missing something? |
|
Date |
User |
Action |
Args |
2008-12-20 16:42:37 | dingo | set | recipients:
+ dingo |
2008-12-20 16:42:37 | dingo | set | messageid: <1229791357.03.0.0672690211922.issue4707@psf.upfronthosting.co.za> |
2008-12-20 16:42:35 | dingo | link | issue4707 messages |
2008-12-20 16:42:34 | dingo | create | |
|