LSD - pounds, shillings and pence
A library for converting between pre-decimal British currency and decimal ('new pence') currency.
Usage
>>> import lsd
>>> from decimal import Decimal
>>> lsd.pounds_shillings_and_pence(Decimal("1.49"))
(1, 9, 10)
>>> lsd.pounds_and_new_pence(19, 19, 6)
Decimal('19.975')
For more usage examples, see the file examples.md
Calculations use the built-in Decimal class for amounts of pounds in new money. Calculation is thus dependent on the constraints of the Decimal class. This does not do arbitrary-precision arithmetic. Thus there are some numbers which are too big to be converted. You can alter these limits by setting the Decimal context in your own code. See [[https://docs.python.org/2/library/decimal.html#context-objects]] or [[https://docs.python.org/3.7/library/decimal.html#context-objects]].
Development
Now using poetry. To run tests do:
poetry run python -m unittest
Thanks
There are only a small number of tests for this project. That's thanks to the awesome hypothesis project which generates test cases for unit tests. It's really powerful for checking edge cases. See [[https://github.com/HypothesisWorks/hypothesis]]
Metadata
Release files for lsd 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lsd-0.4.0.tar.gz | 3.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lsd-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.3 kB
Release files / lsd-0.4.0.tar.gz
| Download URL | lsd-0.4.0.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c01b0b4b421fdd246e3e59056cbf0cc61924c32ee228be6c4f5cd1538a6d2c3b
|
|
BLAKE2b-256 checksum How to use checksums |
540128d7c9d30cb97a1d756967a59c4edf023a807ca75588054be0b24b45a407
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.0.0 CPython/3.13.2 Windows/10
|
Release files / lsd-0.4.0-py3-none-any.whl
| Download URL | lsd-0.4.0-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
972bc3eaadb07819ae9677c90e35ef7637677c596a124c1d789ad27cb400cafe
|
|
BLAKE2b-256 checksum How to use checksums |
4cd841172c286b232796a616b537ec0765cb83f4c1ebcf886be773a4d2d8b8df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.0.0 CPython/3.13.2 Windows/10
|