[Python-Dev] Decimal & returning NotImplemented (or not)

Nick Coghlan ncoghlan at iinet.net.au
Fri Mar 4 16:36:47 CET 2005


Michael Hudson wrote:
> PS: this beahviour seems odd already:
> 
> 
>>>>decimal.getcontext().abs(1)
> 
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "/Users/mwh/Source/python/dist/src/Lib/decimal.py", line 2321, in abs
>     return a.__abs__(context=self)
> TypeError: wrapper __abs__ doesn't take keyword arguments
> 
> couldn't/shouldn't the context methods do a _convert_other (of the
> erroring out kind) of their arguments?

You'll have to ask Facundo that one - it never occurred to me to question it 
until looking into the __rop__ behaviour :)

But I do agree - if nothing else, the _convert_other gives a far more meaningful 
error message when things do go wrong.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at email.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.skystorm.net


More information about the Python-Dev mailing list