Skip to content

Commit

Permalink
tweak the documentation a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
Ken Kundert authored and Ken Kundert committed Dec 29, 2022
1 parent b4e18a5 commit 590996d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ Features
default employs SI scale factors.
- Flexible unit conversion and scaling is supported to make it easy to convert
to or from any required form.
- Provides a small but extensible collection of physical constants.
- Supports the binary scale factors (*Ki*, *Mi*, etc.) along with the normal SI
scale factors (*k*, *M*, etc.).
- When a quantity is created from a string, the actual digits specified can be
used in any output, eliminating any loss of precision.


Alternatives
Expand Down
3 changes: 2 additions & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ Features
default employs SI scale factors.
- Flexible unit conversion and scaling is supported to make it easy to convert
to or from any required form.
- Provides a small but extensible collection of physical constants.
- Supports the binary scale factors (*Ki*, *Mi*, etc.) along with the normal SI
scale factors (*k*, *M*, etc.).
- When a quantity is created from a string, the actual digits specified can be
used in any output, eliminating any loss of precision.


Alternatives
Expand Down
8 changes: 4 additions & 4 deletions doc/user.rst
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ in grams and wanting to present it in either kilograms or in pounds:
.. code-block:: python
>>> m = Quantity('2529 g')
>>> print('mass (kg): %s' % m.render(show_units=False, scale=0.001))
>>> print("mass (kg): {}".format(m.render(show_units=False, scale=0.001)))
mass (kg): 2.529
>>> print(m.render(scale=(0.0022046, 'lb'), form='fixed'))
Expand Down Expand Up @@ -864,7 +864,7 @@ the output, the units can be converted back to the original units if desired:
.. code-block:: python
>>> for time, temp in data:
... print('%-7s %s' % (time.render(scale='min'), temp.render(scale='°F')))
... print("{:<7} {}".format(time.render(scale='min'), temp.render(scale='°F')))
0 min 450 °F
10 min 400 °F
20 min 360 °F
Expand Down Expand Up @@ -2051,12 +2051,12 @@ statement to temporarily override preferences:
>>> with Quantity.prefs(form='fixed', show_units=False, prec=2):
... for time, temp in data:
... print('%-7s %s' % (time, temp))
... print(f"{time:<7} {temp}")
0 505.37
600 477.59
1200 455.37
>>> print('Final temperature = %s @ %s.' % data[-1][::-1])
>>> print(f"Final temperature = {data[-1][1]} @ {data[-1][0]}.")
Final temperature = 455.37 K @ 1.2 ks.
Notice that the specified preferences only affected the table, not the final
Expand Down

0 comments on commit 590996d

Please sign in to comment.