summaryrefslogtreecommitdiff
path: root/numpy/lib/utils.py
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2007-02-02 00:57:43 +0000
committerTravis Oliphant <oliphant@enthought.com>2007-02-02 00:57:43 +0000
commit7a5ce8aa0ad0c5a1f601e021ed3ff319e91995f6 (patch)
tree02950d372aafd20a787742655a9ce45b5089a318 /numpy/lib/utils.py
parenta36ce17c317f8f56f44242714e33b16b37e051ea (diff)
downloadnumpy-7a5ce8aa0ad0c5a1f601e021ed3ff319e91995f6.tar.gz
Fix docstring and rename to byte_bounds.
Diffstat (limited to 'numpy/lib/utils.py')
-rw-r--r--numpy/lib/utils.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/numpy/lib/utils.py b/numpy/lib/utils.py
index ca9ae28aa..ed156bb79 100644
--- a/numpy/lib/utils.py
+++ b/numpy/lib/utils.py
@@ -8,7 +8,7 @@ from numpy.core import product, ndarray
__all__ = ['issubclass_', 'get_numpy_include', 'issubsctype',
'issubdtype', 'deprecate', 'get_numarray_include',
'get_include', 'info', 'source', 'who',
- 'memory_bounds', 'may_share_memory']
+ 'byte_bounds', 'may_share_memory']
def issubclass_(arg1, arg2):
try:
@@ -106,12 +106,15 @@ get_numpy_include = deprecate(get_include, 'get_numpy_include', 'get_include')
# Determine if two arrays can share memory
#--------------------------------------------
-def memory_bounds(a):
+def byte_bounds(a):
"""(low, high) are pointers to the end-points of an array
low is the first byte
high is just *past* the last byte
+ If the array is not single-segment, then it may not actually
+ use every byte between these bounds.
+
The array provided must conform to the Python-side of the array interface
"""
ai = a.__array_interface__
@@ -143,8 +146,8 @@ def may_share_memory(a, b):
A return of True does not necessarily mean that the two arrays
share any element. It just means that they *might*.
"""
- a_low, a_high = memory_bounds(a)
- b_low, b_high = memory_bounds(b)
+ a_low, a_high = byte_bounds(a)
+ b_low, b_high = byte_bounds(b)
if b_low >= a_high or a_low >= b_high:
return False
return True