Author skrah
Recipients Amaury.Forgeot.d'Arc, amaury.forgeotdarc, brian.curtin, casevh, ced, eric.smith, eric.snow, haypo, jjconti, mark.dickinson, pitrou, rhettinger, skrah
Date 2012-02-16.22:25:52
SpamBayes Score 8.96956e-09
Marked as misclassified No
Message-id <20120216222552.GA14823@sleipnir.bytereef.org>
In-reply-to <1329347663.77.0.700121499847.issue7652@psf.upfronthosting.co.za>
Content
STINNER Victor <report@bugs.python.org> wrote:
> decimal.Decimal.__truediv__() has an optional context argument, whereas _decimal defines PyNumberMethods.

Regarding the special methods: decimal.py uses the optional context arguments
for convenience so that these methods can be re-used in other places.

I wouldn't consider this context argument as part of the API.

> decimal.Decimal.quantize() second argument is optional and its default value
> is None, but if I pass None to _decimal.Decimal.quantize(), I get a TypeError
> because _decimal expects an integer.

About this I'm not sure. I think type errors are a courtesy to the user.
Look what is possible now in decimal.py:

Decimal('9')

But here the argument might well be made for accepting None (and only
None apart from rounding modes). - I hope Mark and Raymond will give
their opinions, too.
History
Date User Action Args
2012-02-16 22:25:53skrahsetrecipients: + skrah, rhettinger, amaury.forgeotdarc, mark.dickinson, pitrou, haypo, casevh, eric.smith, jjconti, ced, brian.curtin, Amaury.Forgeot.d'Arc, eric.snow
2012-02-16 22:25:53skrahlinkissue7652 messages
2012-02-16 22:25:52skrahcreate