From 2ed6ef60e704e7707adaaf0925985b6747011fec Mon Sep 17 00:00:00 2001 From: Keewis Date: Sun, 22 Aug 2021 12:07:00 +0200 Subject: describe the structure of quantity formats --- docs/formatting.rst | 15 +++++++++++---- 1 file 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 --------- ======== =================================================== ================================ -- cgit v1.2.1