diff options
author | Matti Picus <matti.picus@gmail.com> | 2020-01-26 13:18:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-26 13:18:13 +0200 |
commit | 0df34013071c1a596c3ce82d1b2c71f1b209ff25 (patch) | |
tree | 92156c34a97ae3c174fdec08b4bda1fe117593d5 | |
parent | e3479124cfab8798c96ff16e0ea46e1e36990007 (diff) | |
parent | b4f97068e60e9be62b3461bac4e0383a6c3ee216 (diff) | |
download | numpy-0df34013071c1a596c3ce82d1b2c71f1b209ff25.tar.gz |
Merge pull request #15428 from sethtroisi/ctype_longlong
DOC: Improve ndarray.ctypes example
-rw-r--r-- | numpy/core/_add_newdocs.py | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/numpy/core/_add_newdocs.py b/numpy/core/_add_newdocs.py index 87ae96fa0..e51755101 100644 --- a/numpy/core/_add_newdocs.py +++ b/numpy/core/_add_newdocs.py @@ -2025,25 +2025,22 @@ add_newdoc('numpy.core.multiarray', 'ndarray', ('ctypes', Examples -------- >>> import ctypes + >>> x = np.array([[0, 1], [2, 3]], dtype=np.int32) >>> x array([[0, 1], - [2, 3]]) + [2, 3]], dtype=int32) >>> x.ctypes.data - 30439712 - >>> x.ctypes.data_as(ctypes.POINTER(ctypes.c_long)) - <ctypes.LP_c_long object at 0x01F01300> - >>> x.ctypes.data_as(ctypes.POINTER(ctypes.c_long)).contents - c_long(0) - >>> x.ctypes.data_as(ctypes.POINTER(ctypes.c_longlong)).contents - c_longlong(4294967296L) + 31962608 # may vary + >>> x.ctypes.data_as(ctypes.POINTER(ctypes.c_uint32)) + <__main__.LP_c_uint object at 0x7ff2fc1fc200> # may vary + >>> x.ctypes.data_as(ctypes.POINTER(ctypes.c_uint32)).contents + c_uint(0) + >>> x.ctypes.data_as(ctypes.POINTER(ctypes.c_uint64)).contents + c_ulong(4294967296) >>> x.ctypes.shape - <numpy.core._internal.c_long_Array_2 object at 0x01FFD580> - >>> x.ctypes.shape_as(ctypes.c_long) - <numpy.core._internal.c_long_Array_2 object at 0x01FCE620> + <numpy.core._internal.c_long_Array_2 object at 0x7ff2fc1fce60> # may vary >>> x.ctypes.strides - <numpy.core._internal.c_long_Array_2 object at 0x01FCE620> - >>> x.ctypes.strides_as(ctypes.c_longlong) - <numpy.core._internal.c_longlong_Array_2 object at 0x01F01300> + <numpy.core._internal.c_long_Array_2 object at 0x7ff2fc1ff320> # may vary """)) |