Python GUI app to impress the boss?

terry tg5027 at citlink.net
Wed Sep 18 00:47:48 EDT 2002


>> Dave LeBlanc wrote:
>> What prevents the creation of a decimal money type?

Absolutely nothing!  And it has been done - sort of.

The problem involves the resultant code to implement a business 
application.  In the simple situation, all the developer has to do is 
be aware on <every> calculation what specific type of variables are  
being used ( integers for quantities, reals for percentages, etc...) 
and what the result 'should' be - and then apply the appropriate 
conditioning to the variables in the calculation and to the result.  
You can surely contemplate the variability in programming styles and 
implementations that this generates - most of which flies in the face 
of the simplicity and readability promised by Python.  Contrast that 
with the following VB code:  Amount = Qty * UnitPrice

The more difficult problem arises when faced with a true quality 
assurance environment.  The amount of validation rises exponentially 
when the calculations in a program are implementation specific, as 
opposed to language intrinsics.  Each calculation must be tested at the 
limits of each of the variables involved - at each instance.

The quick reply to your observation is:  Yes, anything is possible - 
but is forcing a language into an environment to which it is not 
intrinsicly suited a reasonable approach?  All of the databases, that 
Python can easily talk to, have a form of monetary data type.  But when 
those table fields are represented in Python (as well as some other 
languages) they become a burden.

I think Python needs to incorporate an intrinsic data type that 
monetary (as well as other decimal data types) can be represented by, 
so that the above equation yields results consistent with the decimal 
places of the input variables.  This cannot be accomplished with 
real/floats, and shouldn't be accomplished with overlays on integer or 
character variable types.  Python needs this data type, that is not 
hardware oriented, to become truly mainstream and be a threat to VB.

I say this with all due respect to all the other positive attributes of 
Python and it's flexibility to solve a myriad of other non-business 
application problems.

terry




More information about the Python-list mailing list