X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=type%2Fcentcount.py;h=4e5b8a6aa6b4b8ef61671b93b0284825cdf75cbc;hb=31c81f6539969a5eba864d3305f9fb7bf716a367;hp=4181721bbc0d4ab7efe38608b821faa26ecf5bae;hpb=4faa994d32223c8d560d9dad0ca90a3f7eb10d6a;p=python_utils.git diff --git a/type/centcount.py b/type/centcount.py index 4181721..4e5b8a6 100644 --- a/type/centcount.py +++ b/type/centcount.py @@ -11,7 +11,8 @@ T = TypeVar('T', bound='CentCount') class CentCount(object): """A class for representing monetary amounts potentially with - different currencies. + different currencies meant to avoid floating point rounding + issues by treating amount as a simple integral count of cents. """ def __init__ ( @@ -210,7 +211,7 @@ class CentCount(object): centcount = int(float(chunk) * 100.0) elif CentCount.CURRENCY_RE.match(chunk) is not None: currency = chunk - except: + except Exception: pass if centcount is not None and currency is not None: return (centcount, currency)