Skip to main content

LSD - pounds, shillings and pence

PyPI PyPI PyPI Build Status

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]]

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lsd-0.4.0.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lsd-0.4.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file lsd-0.4.0.tar.gz.

File metadata

  • Download URL: lsd-0.4.0.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.13.2 Windows/10

File hashes

Hashes for lsd-0.4.0.tar.gz
Algorithm Hash digest
SHA256 c01b0b4b421fdd246e3e59056cbf0cc61924c32ee228be6c4f5cd1538a6d2c3b
MD5 fae45f14f4a68048b5f7f94ff14b7d82
BLAKE2b-256 540128d7c9d30cb97a1d756967a59c4edf023a807ca75588054be0b24b45a407

See more details on using hashes here.

File details

Details for the file lsd-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: lsd-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.13.2 Windows/10

File hashes

Hashes for lsd-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 972bc3eaadb07819ae9677c90e35ef7637677c596a124c1d789ad27cb400cafe
MD5 521e2fed3662a74f80809afa73056fb2
BLAKE2b-256 4cd841172c286b232796a616b537ec0765cb83f4c1ebcf886be773a4d2d8b8df

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 files

0.3.3

1 file

0.3.2

1 file

0.3.1

1 file

0.3.0

1 file

0.2.0

1 file

0.1.1

1 file

0.1.0

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page