[issue1562] Decimal can't be subclassed useful

Facundo Batista report at bugs.python.org
Mon Jan 7 13:21:23 CET 2008


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
Decimal, as the other currency info makes math ugly. For example:
  
  Money("15.30", currency="USD") + Money("2.33", currency="ARS")

There's a lot of discussion for a Money data type, also, in python-list
and python-dev (I even proposed a pre-PEP), but then Decimal was
implemented; check those lists at the fourth quarter of 2003 for these
posts.

Regards,

----------
resolution:  -> wont fix
status: open -> closed

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


More information about the Python-bugs-list mailing list