Facundo Batista added the comment:
Mark is right, the current behaviour is correct. See Tim post for a
longer explanation.
As general help, for the money class take a look of this:
http://sourceforge.net/projects/pymoney
There you'll see that the approach was to store the value, not subclass
De
Mark Dickinson added the comment:
It's not clear to me that this would be the right behaviour. Unless I'm
missing something, Decimal behaves in just the same way as types like
int, float and str in this respect:
>>> class myint(int): pass
...
>>> a = myint(2)
>>> b = myint(3)
>>> a+b
5
>>> t
Christian Heimes added the comment:
Can you create a patch that replaces Decimal with self.__class__ and the
string "Decimal" with "%s ..." % self.__class__.__name__?
Thanks :)
--
assignee: -> facundobatista
nosy: +facundobatista, tiran
priority: -> normal
type: -> behavior
versions
New submission from poelzi:
The Decimal class doesn't use lookups through self to construct results
in functions like __add__ to generate the resulting object. This makes
subclassing Decimal more or less senseless since all methods have to be
wrapped instead of overriding the __new__ and __ini