summaryrefslogtreecommitdiff
path: root/docs/numpy.ipynb
diff options
context:
space:
mode:
authorHernan Grecco <hernan.grecco@gmail.com>2020-02-21 23:41:43 -0300
committerGitHub <noreply@github.com>2020-02-21 23:41:43 -0300
commit78b1e52958a326cba4983c3ef84016756274c92c (patch)
treedfcaa026318ffb0c06fc82729955da8479c581c2 /docs/numpy.ipynb
parent36ebb0f0e280bbb5b1cd32475e4b13d0222a371c (diff)
parent92dc58e7b1de6a7ad0aaaad48f63490a80e1d82d (diff)
downloadpint-_decimal.tar.gz
Merge branch 'master' into _decimal_decimal
Diffstat (limited to 'docs/numpy.ipynb')
-rw-r--r--docs/numpy.ipynb11
1 files changed, 3 insertions, 8 deletions
diff --git a/docs/numpy.ipynb b/docs/numpy.ipynb
index 2dc6078..41b6491 100644
--- a/docs/numpy.ipynb
+++ b/docs/numpy.ipynb
@@ -24,10 +24,6 @@
"# Import NumPy\n",
"import numpy as np\n",
"\n",
- "# Disable Pint's old fallback behavior (must come before importing Pint)\n",
- "import os\n",
- "os.environ['PINT_ARRAY_PROTOCOL_FALLBACK'] = \"0\"\n",
- "\n",
"# Import Pint\n",
"import pint\n",
"ureg = pint.UnitRegistry()\n",
@@ -778,10 +774,9 @@
"To achive these function and ufunc overrides, Pint uses the ``__array_function__`` and ``__array_ufunc__`` protocols respectively, as recommened by NumPy. This means that functions and ufuncs that Pint does not explicitly handle will error, rather than return a value with units stripped (in contrast to Pint's behavior prior to v0.10). For more\n",
"information on these protocols, see <https://docs.scipy.org/doc/numpy-1.17.0/user/basics.dispatch.html>.\n",
"\n",
- "This behaviour introduces some performance penalties and increased memory usage. Quantities that must be converted to other units require additional memory and CPU cycles. Therefore, for numerically intensive code, you might want to convert the objects first and then use directly the magnitude, such as by using Pint's `wraps` utility (see [wrapping](wrapping.html)).\n",
+ "This behaviour introduces some performance penalties and increased memory usage. Quantities that must be converted to other units require additional memory and CPU cycles. Therefore, for numerically intensive code, you might want to convert the objects first and then use directly the magnitude, such as by using Pint's `wraps` utility (see [wrapping](wrapping.rst)).\n",
"\n",
- "Array interface protocol attributes (such as `__array_struct__` and\n",
- "`__array_interface__`) are available on Pint Quantities by deferring to the corresponding `__array_*` attribute on the magnitude as casted to an ndarray. This has been found to be potentially incorrect and to cause unexpected behavior, and has therefore been deprecated. As of the next minor version of Pint (or when the `PINT_ARRAY_PROTOCOL_FALLBACK` environment variable is set to 0 prior to importing Pint as done at the beginning of this page), attempting to access these attributes will instead raise an AttributeError."
+ "Attempting to access array interface protocol attributes (such as `__array_struct__` and `__array_interface__`) on Pint Quantities will raise an AttributeError, since a Quantity is meant to behave as a \"duck array,\" and not a pure ndarray."
]
}
],
@@ -801,7 +796,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.6.7"
+ "version": "3.7.6"
}
},
"nbformat": 4,