prePEP: Decimal data type

John Roth newsgroups at jhrothjr.com
Thu Nov 6 15:49:51 EST 2003


"Aahz" <aahz at pythoncraft.com> wrote in message
news:boebf0$ird$1 at panix1.panix.com...
> In article <vqlaif4imh9k98 at news.supernews.com>,
> John Roth <newsgroups at jhrothjr.com> wrote:
> >
> >AFAICS, there are only two solutions:
> >
> ><decimal>.add(<number>, [<result spec>])
> >
> >and
> >
> ><context>.add(<decimal>, <number>)
>
> Both are too inconvenient for casual users.  I think that for the Money
> subclass, it'll probably make sense to require users to specify an
> explicit Context before the first operation (raising an exception if not
> initialized).  For Decimal, using the same defaults as Rexx will
> probably work just fine.

The trouble is that most of the difficulty that's being discussed
is not for casual users. It's for professional users that have
to adhere to legal, regulatory and other requirements that have
no inherent underlying order that makes them amenable to
a nice, neat and trivially understandable solution.

If coming up with something that is understandable to novices
is a rock bottom requirement, then I most respectfully suggest
that the rest of the discussion is a waste of time.

The part of my response which you didn't quote said something
about my not being able to find an expression syntax that would
handle these essentially arbitrary and capricious regulations. If
you would suggest one, I'd be delighted.

Of course, I do have a suggestion for an infix notation that
would work. I predict that it will be absolutely unacceptable
to all parties.

<number> [+, <context>] <number>

In the spirit (if not the letter) of PEP 225. Notice that it simply
distributes the pieces of the expression differently.

John Roth


> -- 
> Aahz (aahz at pythoncraft.com)           <*>
http://www.pythoncraft.com/
>
> "It is easier to optimize correct code than to correct optimized code."
> --Bill Harlan






More information about the Python-list mailing list