Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
56c7afe1
Commit
56c7afe1
authored
Nov 29, 2012
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #163 from joonro/patch-5
Minor cleanup of a couple of examples
parents
25b44c99
630b4b13
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
docs/src/userguide/sharing_declarations.rst
docs/src/userguide/sharing_declarations.rst
+12
-10
No files found.
docs/src/userguide/sharing_declarations.rst
View file @
56c7afe1
...
@@ -73,8 +73,8 @@ statement::
...
@@ -73,8 +73,8 @@ statement::
from module cimport name [as name] [, name [as name] ...]
from module cimport name [as name] [, name [as name] ...]
Here is an example.
The file on the left
is a definition file which exports a
Here is an example.
:file:`dishes.pxd`
is a definition file which exports a
C data type.
The file on the right is
an implementation file which imports and
C data type.
:file:`restaurant.pxd`
an implementation file which imports and
uses it.
uses it.
:file:`dishes.pxd`::
:file:`dishes.pxd`::
...
@@ -136,12 +136,12 @@ for an imaginary module, and :keyword:`cimport` that module. You can then
...
@@ -136,12 +136,12 @@ for an imaginary module, and :keyword:`cimport` that module. You can then
refer to the C functions by qualifying them with the name of the module.
refer to the C functions by qualifying them with the name of the module.
Here's an example:
Here's an example:
:file:`c_lunch.pxd`
::
:file:`c_lunch.pxd`::
cdef extern from "lunch.h":
cdef extern from "lunch.h":
void eject_tomato(float)
void eject_tomato(float)
:file:`lunch.pyx`
::
:file:`lunch.pyx`::
cimport c_lunch
cimport c_lunch
...
@@ -205,14 +205,16 @@ definition part, and may not add any further C attributes. It may also define
...
@@ -205,14 +205,16 @@ definition part, and may not add any further C attributes. It may also define
Python methods.
Python methods.
Here is an example of a module which defines and exports an extension type,
Here is an example of a module which defines and exports an extension type,
and another module which uses it.::
and another module which uses it:
# Shrubbing.pxd
:file:`Shrubbing.pyd`::
cdef class Shrubbery:
cdef class Shrubbery:
cdef int width
cdef int width
cdef int length
cdef int length
# Shrubbing.pyx
:file:`Shrubbing.pyx`::
cdef class Shrubbery:
cdef class Shrubbery:
def __cinit__(self, int w, int l):
def __cinit__(self, int w, int l):
self.width = w
self.width = w
...
@@ -221,8 +223,8 @@ and another module which uses it.::
...
@@ -221,8 +223,8 @@ and another module which uses it.::
def standard_shrubbery():
def standard_shrubbery():
return Shrubbery(3, 7)
return Shrubbery(3, 7)
:file:`Landscaping.pyx`::
# Landscaping.pyx
cimport Shrubbing
cimport Shrubbing
import Shrubbing
import Shrubbing
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment