Numeric data question

Terry Grogan tgrogan at datamarksystems.com
Wed Jul 24 14:12:44 EDT 2002


Thanks Alex.  Probably, typeless was not the right word.  You 
have given me hope and direction.

terry

>>
>>  > I'm guessing now (from lack of real experience) that being
>>  > a 'typeless' language that I would be forced into
>>  > contriving a method for handling money such that I could
>>  > never code something straightforwardly like:
>>  > TotalCost = Quantity * UnitCost
>>  >  (where Quantity is integer and the others money).
>>
>>  If you were working with a typeless language, that might be
>> the case.
>>
>>  Fortunately, Python is strongly typed, so that's no problem,
>> of course.  This statement would probably be equivalent to
>> something like:
>>
>>          TotalCost = type(UnitCost).__rmul__(Quantity(
>>
>>  for example (or UnitCost.__class__.__rmul__ if UnitCost was
>> an instance of an old-fashioned class, but that comes to much
>> the same thing).  Just code your __rmul__ (and __mul__, etc)
>> methods and voila, whatever numeric type you want is there.
>>
>>  http://starship.python.net/crew/aahz/Decimal.py is an
>> example, though Aahz still doesn't consider it finished.
>>
>>  > Am I loonie, or is Python just not inherently suitable for
>>  > accounting applications for this reason?
>>
>>  If you're saying that Python is "typeless", then I guess
>>  "loonie" might be applicable, yes.
>>
>>
>>  Alex

-- 
Terry Grogan
Datamark Systems
703-975-6250




More information about the Python-list mailing list