Re: [Python-3000] Rounding in Py3k

2006-08-10 Thread Guido van Rossum
On 8/4/06, Ron Adam <[EMAIL PROTECTED]> wrote: > But that doesn't explain why int, long, and float, don't have other > non-magic methods. > > I'm not attempting taking sides for or against either way, I just want > to understand the reasons as it seems like by knowing that, the correct > way to do

Re: [Python-3000] Rounding in Py3k

2006-08-04 Thread Ron Adam
Greg Ewing wrote: > Ron Adam wrote: > >> I'm still not sure why "__round__" should be preferred in place of >> "round" as a method name. There isn't an operator associated to >> rounding so wouldn't the method name not have underscores? > > I was thinking there would be functions such as round

Re: [Python-3000] Rounding in Py3k

2006-08-04 Thread Greg Ewing
Ron Adam wrote: > I'm still not sure why "__round__" should be preferred in place of > "round" as a method name. There isn't an operator associated to > rounding so wouldn't the method name not have underscores? I was thinking there would be functions such as round(), trunc(), etc. that use __

Re: [Python-3000] Rounding in Py3k

2006-08-03 Thread Ron Adam
Greg Ewing wrote: > Nick Coghlan wrote: > >> Would it be worthwhile to design a common rounding mechanism that can be >> used >> to cleanly round values to the built in floating point type, as well as >> being >> able to access the different rounding modes for decimal instances? > > Sounds li

Re: [Python-3000] Rounding in Py3k

2006-08-03 Thread Greg Ewing
Nick Coghlan wrote: > Would it be worthwhile to design a common rounding mechanism that can be used > to cleanly round values to the built in floating point type, as well as being > able to access the different rounding modes for decimal instances? Sounds like a job for a new protocol, such as

Re: [Python-3000] Rounding in Py3k

2006-08-03 Thread Greg Ewing
Nick Coghlan wrote: > The implicit Decimal->float conversion Hang on, I thought there weren't supposed to be any implicit conversions between Decimal and float. -- Greg ___ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/

[Python-3000] Rounding in Py3k

2006-08-03 Thread Nick Coghlan
Some musings inspired by the rounding discussion on python-dev. The Decimal module provides all of the rounding modes from the general decimal arithmetic specification [1]. Both Decimal rounding methods (quantize() and to_integral()) return Decimal instances - a subsequent explicit conversion t