◐ Shell
clean mode source ↗

Message 58241 - Python tracker

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__(...)