[issue1562] Decimal can't be subclassed useful

2008-01-07 Thread Facundo Batista
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

[issue1562] Decimal can't be subclassed useful

2007-12-07 Thread Mark Dickinson
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

[issue1562] Decimal can't be subclassed useful

2007-12-07 Thread Christian Heimes
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

[issue1562] Decimal can't be subclassed useful

2007-12-06 Thread poelzi
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