Python GUI app to impress the boss?

Alex Martelli aleax at aleax.it
Wed Sep 18 02:59:15 EDT 2002


David LeBlanc wrote:
        ...
> What prevents the creation of a decimal money type? I agree, it would be

Nothing prevents it.  In particular, nothing prevents implementing such
a type in Python itself.  There are various implementations of decimal
numbers around, including one (not sure how mature and complete) that
meets the standards for decimal arithmetic behavior (as per the IBM Rexx
implementation).  It seems to me a relatively simple problem, compared
with many others that are routinely solved by Python programmers.  If
there's no single "best of breed" Currency extension that dominates the
scene (as, for example, Lemburg's mxDateTime dominates the date-time
handling scene) I suspect it must be because of a lack of demand, strange
as it may seem.  Defining new types is SO easy...

So prove my suspicion wrong: pick an almost-there implementation,
complete it per your specs, release it, and see it take over the
world.  How much effort can it be...?

> nice if python could do something akin to calculator aritmetic with types
> like scientific (covered) engineering (improper scientific with the
> exponent as a power of 3 and the (oops, forgot the term - mantissa?) more

That's just an issue of display, isn't it?  Computations are just the
same whether the calculator is set to always display exponents as a
power of three, or not -- at least, that's how I recall my calculator
worked: a single button switched display mode from scientific to
engineering and back, but all numbers in the calculator's stack and
registers were supremely unaffected by it.

> then a single digit as in 12.2e3), fixed precision (1..n to the right of
> the decimal). The forthcoming fractions are going to be interesting...
> (chinese interpretation).

If by "fractions" you mean Rationals, that's another thing yet.


> Be nice too if math could do rads, grads and decimal degrees.

That's a completely different issue: math is a module, not a type.
In this case, what you want is simply a different module that wraps
math and multiplies/divides some arguments or results by appropriate
conversion factors.  Still a pretty modest programming effort (all
of, what, 10 minutes...?).  Modifying the math module to behave this
way upon some switch set in it should not be much more.


> Just my $0.02 worth.

If you really think, just to take a simple example, that having
a sin function that accepts degrees rather than radians is
important for Python, why not just take the 10 minutes to
implement that (or 20 minutes, if you're keep to modify rather
than wrap the math module) and thus prove I'm wrong in suspecting
that such a project would be pretty much useless...?

I'll even volunteer to perform the programming part of the task
(not a huge commitment:-) if you undertake to deal with testing,
documentation, and advocacy (to get it widely used, and in the
long run to get it into the core by popular demand).


Alex




More information about the Python-list mailing list