summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHernan Grecco <hernan.grecco@gmail.com>2013-12-14 23:15:38 -0300
committerHernan Grecco <hernan.grecco@gmail.com>2013-12-14 23:15:38 -0300
commitde1d938a335e09f840c4a865923123f16412d1f4 (patch)
tree2206cea2de02e7c0d59204056497d3f1f85a4756
parentd9c14d76dd50e918f33c4c3109e967667f255e26 (diff)
downloadpint-de1d938a335e09f840c4a865923123f16412d1f4.tar.gz
Started Context docs
-rw-r--r--docs/contexts.rst14
1 files changed, 3 insertions, 11 deletions
diff --git a/docs/contexts.rst b/docs/contexts.rst
index 324b775..cda0660 100644
--- a/docs/contexts.rst
+++ b/docs/contexts.rst
@@ -29,29 +29,21 @@ You need to use the relation `wavelength = speed_of_light * frequency`:
To make this task easy, Pint has the concept of `contexts` which provides convertion
rules between dimensions. For example, the relation between wavelength and frequency is
-defined in the spectroscopy context. You can tell pint to use this context when you
-convert a quantity to different units.
+defined in the `spectroscopy` context (abbreviated `sp`). You can tell pint to use
+this context when you convert a quantity to different units.
..doctest::
- >>> q.to('Hz', context='spectroscopy')
+ >>> q.to('Hz', 'spectroscopy')
<Quantity(5.99584916e+14, 'hertz')>
or with the abbreviated form:
..doctest::
- >>> q.to('Hz', context='sp')
- <Quantity(5.99584916e+14, 'hertz')>
-
-or even shorter:
-
-..doctest::
-
>>> q.to('Hz', 'sp')
<Quantity(5.99584916e+14, 'hertz')>
-
Contexts can be also enabled for blocks of code using the `with` statement:
..doctest::