Python GUI app to impress the boss?

ChrisBarker Chris.Barker at noaa.gov
Wed Sep 18 13:01:01 EDT 2002


terry wrote:

 > Contrast that
> with the following VB code:  Amount = Qty * UnitPrice

> 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.

Well, sure. This is obviously a stupid way to go about...That's what 
object oriented programming is all about. What you need to do is create 
a currency class that behaves like it should, and then use it everywhere 
you want currency. Then you can do:

Amount = Qty * UnitPrice

just like VB.

> 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?

This is not an issue of suitability of Python.

> I think Python needs to incorporate an intrinsic data type that 
> monetary

Yes, it would be4 very useful to have that data type, but it really 
doesn't make any difference whether it is intrinsic or not.


> and shouldn't be accomplished with overlays on integer or 
> character variable types.

Why not? what do you think VB is doing? All machines that VB runs on use 
binary integer and floating point arithmetic..so a currency data type 
HAS to be based on those. It's just a question of whether you write the 
"overlays" in Python, C, assembly, or whatever. And you are free to 
extend Python in those languages if you like. The only reason I can see 
to not writing your class in Python is performance, and unless you are 
doing a lot of calculations, that is probably a non-issue.

If someone writes a nice one, maybe it could even be put intot he 
standard library.

> Python needs this data type, that is not 
> hardware oriented, to become truly mainstream and be a threat to VB.

Python needs the equivalent of the MS marketing machine to 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.

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer
                                     		
NOAA/OR&R/HAZMAT         (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov




More information about the Python-list mailing list