PEP 327: Decimal Data Type

Josiah Carlson jcarlson at nospam.uci.edu
Mon Feb 2 22:55:44 CET 2004


> But if you normalise every time, some theoretically simple operations
> can become relatively very expensive in terms of time. (Basically,
> things like addition, which suddenly require a GCD calculation).

If we are to take cues from standard Python numeric types, any 
mathematical calculation results in a new immutable object.  Thusly, 
only normalizing on initialization is sufficient.  Since that is the 
only time you ever get anything new, doing GCD on initialization is the 
minimum and maximum requirement.

  - Josiah



More information about the Python-list mailing list