projects
/
python_utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Various changes.
[python_utils.git]
/
type
/
centcount.py
diff --git
a/type/centcount.py
b/type/centcount.py
index 4181721bbc0d4ab7efe38608b821faa26ecf5bae..4e5b8a6aa6b4b8ef61671b93b0284825cdf75cbc 100644
(file)
--- 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
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__ (
"""
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
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)
pass
if centcount is not None and currency is not None:
return (centcount, currency)