Blake T. Garretson wrote:
Thanks for the suggestions and modified module. I will probably just
use this fixed module to solve my immediate problem.
Expect its performance to be worse than the standard version - it does the right
thing, but it sure ain't pretty. . .
Cheers,
Nick.
--
Nick Coghlan
Blake T. Garretson wrote:
If Decimal objects prematurely throw a TypeError before trying the
__rop__, is Decimal broken, or was it designed this way?
I suspect the former, since I can't recall this subject coming up at any point
during the PEP approval or implementation process. And I was one of
Nick Coghlan wrote:
a) Checking that replacing the relevant raise TypeError calls in
Lib/Decimal.py with return NotImplemented gives you friendlier behaviour.
It turns out this isn't really practical - there's too much code in the module
relying on those TypeErrors being raised.
So this may
Nick Coghlan wrote:
Nick Coghlan wrote:
a) Checking that replacing the relevant raise TypeError calls in
Lib/Decimal.py with return NotImplemented gives you friendlier
behaviour.
It turns out this isn't really practical - there's too much code in the
module relying on those TypeErrors being
Title: RE: Decimal, __radd__, and custom numeric types...
[Nick Coghlan]
#- a) Checking that replacing the relevant raise TypeError
#- calls in
#- Lib/Decimal.py with return NotImplemented gives you friendlier
#- behaviour.
#-
#-
#- It turns out this isn't really practical
Batista, Facundo wrote:
[Nick Coghlan]
#- a) Checking that replacing the relevant raise TypeError
#- calls in
#- Lib/Decimal.py with return NotImplemented gives you friendlier
#- behaviour.
#-
#-
#- It turns out this isn't really practical - there's too
#- much code in the
#- module relying
Thanks for the suggestions and modified module. I will probably just
use this fixed module to solve my immediate problem. I appreciate
your post to python-dev as well; it looks like this may be addressed in
a future release. :)
Thanks,
Blake
--
I'm having some issues with decimal.Decimal objects playing nice with
custom data types. I have my own matrix and rational classes which
implement __add__ and __radd__. They know what to do with Decimal
objects and react appropriately.
The problem is that they only work with Decimals if the
Blake T. Garretson [EMAIL PROTECTED] wrote:
I'm having some issues with decimal.Decimal objects playing nice with
custom data types. I have my own matrix and rational classes which
implement __add__ and __radd__. They know what to do with Decimal
objects and react appropriately.
The
On 28 Feb 2005 12:11:33 -0800, Blake T. Garretson
[EMAIL PROTECTED] wrote:
[...]
From the Python docs (specifically sections 3.3.7 and 3.3.8), I thought
that the left object should try its own __add__, and if it doesn't know
what to do, THEN try the right object's __radd__ method.
To me it
10 matches
Mail list logo