summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Timkovich <prometheus235@gmail.com>2018-09-22 16:19:21 -0500
committerGitHub <noreply@github.com>2018-09-22 16:19:21 -0500
commitd4ac4e33c03032cd15a588eb56dba00a25bcaae3 (patch)
treebd7659bf9748b694be005ccf321c2741e07190d7
parentc4c9683ede47eb939bce78a9d564b06665a1ebf2 (diff)
downloadcython-d4ac4e33c03032cd15a588eb56dba00a25bcaae3.tar.gz
Call out the different name used for the wrapper
Explicitly call out the different name used for the wrapper `.pyx` file vs. the other C++ sources As a new user, I was following along and just called the `.pyx` file `Rectangle.pyx` like everything else which was kinda confusing then when in the `wrapping_CPlusPlus/setup.py` there's a `setup(ext_modules=cythonize("rect.pyx"))` and I was thinking that maybe that file was magically created somehow and was miffed. Hoisted the blurb on why the file name needs to be different without some additional work and worded it in there.
-rw-r--r--docs/src/userguide/wrapping_CPlusPlus.rst10
1 files changed, 6 insertions, 4 deletions
diff --git a/docs/src/userguide/wrapping_CPlusPlus.rst b/docs/src/userguide/wrapping_CPlusPlus.rst
index 94c5df5f1..a60909732 100644
--- a/docs/src/userguide/wrapping_CPlusPlus.rst
+++ b/docs/src/userguide/wrapping_CPlusPlus.rst
@@ -111,7 +111,12 @@ of the :func:`cythonize` function.
Declare a var with the wrapped C++ class
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-Now, we use cdef to declare a var of the class with the C++ ``new`` statement:
+We'll create a ``.pyx`` file named ``rect.pyx`` to build our wrapper. We're
+using a name other than ``Rectangle``, but if you prefer giving the same name
+to the wrapper as the C++ class, see the section on
+:ref:`resolving naming conflicts <resolve-conflicts>`.
+
+Within, we use cdef to declare a var of the class with the C++ ``new`` statement:
.. literalinclude:: ../../examples/userguide/wrapping_CPlusPlus/cython_usage.pyx
@@ -164,9 +169,6 @@ instance.
.. literalinclude:: ../../examples/userguide/wrapping_CPlusPlus/rect_ptr.pyx
-If you prefer giving the same name to the wrapper as the C++ class, see the
-section on :ref:`resolving naming conflicts <resolve-conflicts>`.
-
Compilation and Importing
=========================