Skip to content

Commit

Permalink
Update tutorial.rst
Browse files Browse the repository at this point in the history
More attempts to make doc text and doc build happy.

Signed-off-by: Michael Tiemann <[email protected]>
  • Loading branch information
MichaelTiemannOSC committed Oct 22, 2023
1 parent 58f2461 commit b4b4616
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions docs/getting/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,23 @@ Some units are compound, such as [energy], which is stated in terms of
[mass] * [length]**2 / [time]**2. Earlier versions of Pint would sort unit names
alphabetically by default, leading to different orderings of units (old behavior):

>>> "{:P}".format(pint.Quantity('1 pound * ft**2 * second**-2'))
'1.0 foot²·pound/second²'
>>> "{:P}".format(pint.Quantity('1 kg * cm**2 * second**-2'))
'1.0 centimeter²·kilogram/second²'
.. doctest::

>>> "{:P}".format(ureg.parse_units('pound * ft**2 * second**-2'))
'foot²·pound/second²'
>>> "{:P}".format(ureg.parse_units('kg * cm**2 * second**-2'))
'centimeter²·kilogram/second²'

Now by default it sorts by dimensions as proposed by ISO 80000, with [mass]
coming before [length], which also comes before [time]. The dimension order
can be changed in the registry (`dim_order` in `defaults`):

>>> "{:P}".format(pint.Quantity('1 pound * ft**2 * second**-2'))
'1.0 pound·foot²/second²'
>>> "{:P}".format(pint.Quantity('1 kg * cm**2 * second**-2'))
'1.0 kilogram·centimeter²/second²'
.. doctest::

>>> "{:P}".format(ureg.parse_units('pound * ft**2 * second**-2'))
'pound·foot²/second²'
>>> "{:P}".format(ureg.parse_units('kg * cm**2 * second**-2'))
'kilogram·centimeter²/second²'



Expand Down

0 comments on commit b4b4616

Please sign in to comment.