diff options
author | zjpoh <poh.zijie@gmail.com> | 2019-09-26 22:04:11 -0700 |
---|---|---|
committer | zjpoh <poh.zijie@gmail.com> | 2019-09-26 22:04:11 -0700 |
commit | 27332a8b2b098a519e8ade0706e1ae4086f15b92 (patch) | |
tree | 4d28425c7df1fa9127a8f1cd9a3c04f449fb35e2 /doc/source/user/c-info.python-as-glue.rst | |
parent | f779af07a92cb419b964316960a1b503df9b712d (diff) | |
parent | 68bd6e359a6b0863acf39cad637e1444d78eabd0 (diff) | |
download | numpy-27332a8b2b098a519e8ade0706e1ae4086f15b92.tar.gz |
Merge branch 'master' into from_string_complex
Diffstat (limited to 'doc/source/user/c-info.python-as-glue.rst')
-rw-r--r-- | doc/source/user/c-info.python-as-glue.rst | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/doc/source/user/c-info.python-as-glue.rst b/doc/source/user/c-info.python-as-glue.rst index 01d2a64d1..7b9b096af 100644 --- a/doc/source/user/c-info.python-as-glue.rst +++ b/doc/source/user/c-info.python-as-glue.rst @@ -387,7 +387,7 @@ distribution of the ``add.f`` module (as part of the package Installation of the new package is easy using:: - python setup.py install + pip install . assuming you have the proper permissions to write to the main site- packages directory for the version of Python you are using. For the @@ -744,14 +744,14 @@ around this restriction that allow ctypes to integrate with other objects. 1. Don't set the argtypes attribute of the function object and define an - :obj:`_as_parameter_` method for the object you want to pass in. The - :obj:`_as_parameter_` method must return a Python int which will be passed + ``_as_parameter_`` method for the object you want to pass in. The + ``_as_parameter_`` method must return a Python int which will be passed directly to the function. 2. Set the argtypes attribute to a list whose entries contain objects with a classmethod named from_param that knows how to convert your object to an object that ctypes can understand (an int/long, string, - unicode, or object with the :obj:`_as_parameter_` attribute). + unicode, or object with the ``_as_parameter_`` attribute). NumPy uses both methods with a preference for the second method because it can be safer. The ctypes attribute of the ndarray returns @@ -764,7 +764,7 @@ correct type, shape, and has the correct flags set or risk nasty crashes if the data-pointer to inappropriate arrays are passed in. To implement the second method, NumPy provides the class-factory -function :func:`ndpointer` in the :mod:`ctypeslib` module. This +function :func:`ndpointer` in the :mod:`numpy.ctypeslib` module. This class-factory function produces an appropriate class that can be placed in an argtypes attribute entry of a ctypes function. The class will contain a from_param method which ctypes will use to convert any |