[New-bugs-announce] [issue1562] Decimal can't be subclassed useful

poelzi report at bugs.python.org
Thu Dec 6 15:13:37 CET 2007


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 __init__ methods, which 
could be enough for immutable type.
Currently I'm implementing a Money class which is more or less a 
Decimal with addition currency information. Because resulting Types 
generated with something like return Decimal(something) instead of 
self.__new__(...)

----------
components: Library (Lib)
messages: 58241
nosy: poelzi
severity: normal
status: open
title: Decimal can't be subclassed useful
versions: Python 2.5

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1562>
__________________________________


More information about the New-bugs-announce mailing list