diff options
| author | Clark Willison <clarkgwillison@gmail.com> | 2020-06-16 13:09:47 -0700 |
|---|---|---|
| committer | Clark Willison <clarkgwillison@gmail.com> | 2020-06-16 13:52:13 -0700 |
| commit | 82fdd3c591e21c222902e467360e9ca218e5ca9f (patch) | |
| tree | 82378575f190ec4adb6bcfed888717b87deb11ee /docs | |
| parent | 521e63a9ea914a6936000bc02dfb57d488c5a383 (diff) | |
| download | pint-82fdd3c591e21c222902e467360e9ca218e5ca9f.tar.gz | |
document new ureg.__contains__ feature
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/defining.rst | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/docs/defining.rst b/docs/defining.rst index 152893a..fd5c2d4 100644 --- a/docs/defining.rst +++ b/docs/defining.rst @@ -152,3 +152,17 @@ leading underscore: >>> ureg.define('mpg = 1 * mile / gallon') >>> fuel_ec_europe = 5 * ureg.L / ureg._100km >>> fuel_ec_us = (1 / fuel_ec_europe).to(ureg.mpg) + + +Checking if a unit is already defined +------------------------------------- + +The python ``in`` keyword works as expected with unit registries. Check if +a unit has been defined with the following: + +.. doctest:: + + >>> 'MHz' in ureg + True + >>> 'gigatrees' in ureg + False |
