prePEP: Money data type
Alex Martelli
aleaxit at yahoo.com
Tue Oct 21 18:16:27 EDT 2003
Batista, Facundo wrote:
> Alex Martelli wrote:
>
> #- I like the idea of delegating ALL build-by-parsing-string
> #- functionality
> #- to a Money.parse classmethod -- it nicely matches my suggestion of
> #- delegating any fancy emit-string functionality to a .format instance
> #- method. This would let Money.__init__ (or Money.__new__, whatever)
> #- remain simpler, without need for "decimal separators" etc.
>
> .parse or .fromString?
>
> .format is nice.
Either fromString and toString, or parse and format -- be consistent:-).
And to summarize the parallel discussion on python-dev for others:
It seems the arithmetic part should be dealt by fixing the sandbox's
Decimal (just make sure rounding IS programmable...;-), but then we
can have, that one for arithmetic, AND a mixin for formatting, giving
a Money by multiple inheritance; sounds cool to me:-).
Maybe Python 2.4 WILL have some Money at long last...!-)
Alex
More information about the Python-list
mailing list