diff options
author | Keewis <keewis@posteo.de> | 2021-08-22 12:07:00 +0200 |
---|---|---|
committer | Keewis <keewis@posteo.de> | 2021-08-23 23:36:39 +0200 |
commit | 2ed6ef60e704e7707adaaf0925985b6747011fec (patch) | |
tree | 0b353c7d21deee5f2e33baa4254fced6c998c276 /docs | |
parent | b273758106984ccf9bc502bafc1ad1a34024068d (diff) | |
download | pint-2ed6ef60e704e7707adaaf0925985b6747011fec.tar.gz |
describe the structure of quantity formats
Diffstat (limited to 'docs')
-rw-r--r-- | docs/formatting.rst | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/docs/formatting.rst b/docs/formatting.rst index 1d1bc91..743506f 100644 --- a/docs/formatting.rst +++ b/docs/formatting.rst @@ -49,8 +49,6 @@ Let's look at some examples: ureg.default_format = "" # TODO: switch to None f"{u}" # default: default -**TODO**: describe quantity formats - Unit Format Types ----------------- ``pint`` comes with a variety of unit formats: @@ -66,8 +64,13 @@ Spec Name Example ``C`` compact ``kilogram*meter/second**2`` ======= =============== ====================================================================== -Quantity Formats ----------------- +Quantity Format Specifications +------------------------------ +In addition to the structure of :py:class:`Unit` format specifications, +:py:class:`Quantity` format specifications also may contain a format spec for the +magnitude. For example, ``".8f~P"`` formats the magnitude in floating point notation +with 8 digits and the unit in the short pretty format. + .. ipython:: python q = 1e-6 * u @@ -81,6 +84,10 @@ Quantity Formats f"{q:.2f~#P}" # short compact pretty with 8 float digits f"{q:#~}" # compact short default +Quantity Format Types +--------------------- +There are no special quantity formats yet. + Modifiers --------- ======== =================================================== ================================ |