On Jan 4, 2008 8:37 AM, Facundo Batista <[EMAIL PROTECTED]> wrote: > 2008/1/4, Mark Dickinson <[EMAIL PROTECTED]>: > > > That seems a little peculiar to me: wouldn't it be more natural to have > > round(Decimal_instance) return another Decimal? > > Yes. > > Now I find that now round() delegates its work to __round__: > > http://docs.python.org/dev/library/functions.html#round > > This doc says that round() "Return the floating point value x rounded > to n digits after the decimal point.". > > It don't specify if its binary or decimal floating point, ;) > > Feel free to create an issue and assign to me if you think that this > should be done.
In 3.0, round() of a Decimal should return an int if invoked with 1 arg, a Decimal if invoked with 2. Similar for round() of a float. round() of an int can always return an int. In 2.6, round() should always return a float, regardless of the type of the first arg or the arg count, for best compatibility with 2.5. -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com