[Python-Dev] proposal: add basic money type to the standard library
Fredrik Lundh
fredrik@pythonware.com
Tue, 26 Feb 2002 21:52:48 +0100
mal wrote:
> > I propose adding an "abstract" money base type to the standard
> > library, to be subclassed by real money/decimal implementations.
> >
> > if isinstance(v, basemoney):
> > # yay! it's money
> > print float(money) # let's hope it's not too much
> >
> > The goal is not to standardize any behaviour beyond this; anything
> > else should be provided by subtypes.
> >
> > More details here:
> >
> > http://effbot.org/ideas/money-type.htm
> >
> > I can produce PEP and patch if necessary.
>
> Sounds like a plan.
>
> One thing though: the RE "[+|-]?\d+(.\d+)?" should be extended
> to allow for currency symbols and names in front or after the
> monetary value.
isn't this better handled by a separate method/attribute?
(otherwise, I fear that we'll end up adding all possible currency
notations to the abstract type. but maybe there is a standard
for this, somewhere?)
</F>