diff options
author | Thien-Thi Nguyen <ttn@gnuvola.org> | 2022-02-10 14:03:30 -0500 |
---|---|---|
committer | Thien-Thi Nguyen <ttn@gnuvola.org> | 2022-02-10 14:03:30 -0500 |
commit | 97fa3789735fdb8518bcd26f4154f3fc379a9e78 (patch) | |
tree | c7855d0ba443fbb748306ec2144d74adca4250f0 /doc | |
parent | ef8e148d3672f776503b19eb47e9b161d1c61091 (diff) | |
download | taler-util-97fa3789735fdb8518bcd26f4154f3fc379a9e78.tar.gz taler-util-97fa3789735fdb8518bcd26f4154f3fc379a9e78.tar.bz2 taler-util-97fa3789735fdb8518bcd26f4154f3fc379a9e78.zip |
update "import" statement, plus all downstream references
Thanks to MS for the Pythonic advice. :-D
Diffstat (limited to 'doc')
-rw-r--r-- | doc/doc.org | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/doc/doc.org b/doc/doc.org index 84702ae..7834a48 100644 --- a/doc/doc.org +++ b/doc/doc.org @@ -63,9 +63,9 @@ the constructor throws an =AmountOverflowError= exception. The constructor takes three args: /currency/, /value/, /fraction/. -: >>> import taler.util.amount as Amount +: >>> from taler.util import amount : # KUDOS 10.50 -: >>> amt = Amount.Amount ("KUDOS", 10, 50000000) +: >>> amt = amount.Amount ("KUDOS", 10, 50000000) : >>> amt : Amount(currency='KUDOS', value=10, fraction=50000000) @@ -78,7 +78,7 @@ You can use classmethod =parse= to read a string as an =Amount= object. This function can throw =AmountFormatError= if the string is malformed, and =AmountOverflowError= if the fraction portion is too long. -: >>> Amount.Amount.parse ("KUDOS:10.12345678") +: >>> amount.Amount.parse ("KUDOS:10.12345678") : Amount(currency='KUDOS', value=10, fraction=12345678) An =Amount= object supports addition and subtraction. @@ -87,7 +87,7 @@ a =CurrencyMismatchError= exception. : >>> amt + amt : Amount(currency='KUDOS', value=21, fraction=0) -: >>> another = Amount.Amount ("KUDOS", 5, 42) +: >>> another = amount.Amount ("KUDOS", 5, 42) : >>> amt - another : Amount(currency='KUDOS', value=5, fraction=49999958) @@ -164,7 +164,7 @@ The classmethod =parse= recognizes a leading =+= or =-=, and additionally accepts a plain =CURRENCY:VALUE.FRACTION= form as a positive =SignedAmount=. -: >>> Amount.SignedAmount.parse ("-KUDOS:2.34") +: >>> amount.SignedAmount.parse ("-KUDOS:2.34") : SignedAmount(is_positive=False, amount=Amount(currency='KUDOS', value=2, fraction=34000000)) Lastly, a =SignedAmount= object can flip its sign using a unary minus. |