Commit d4ac4e33 authored by Nick Timkovich's avatar Nick Timkovich Committed by GitHub

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.
parent c4c9683e
...@@ -111,7 +111,12 @@ of the :func:`cythonize` function. ...@@ -111,7 +111,12 @@ of the :func:`cythonize` function.
Declare a var with the wrapped C++ class 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 .. literalinclude:: ../../examples/userguide/wrapping_CPlusPlus/cython_usage.pyx
...@@ -164,9 +169,6 @@ instance. ...@@ -164,9 +169,6 @@ instance.
.. literalinclude:: ../../examples/userguide/wrapping_CPlusPlus/rect_ptr.pyx .. 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 Compilation and Importing
========================= =========================
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment