From: Joon Ro Date: Thu, 29 Nov 2012 17:14:49 +0000 (-0600) Subject: Minor cleanup of a couple of examples X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b9caa7fa7c6aea337cf3162c5cb3a5c2beeb6637;p=platform%2Fupstream%2Fpython-cython.git Minor cleanup of a couple of examples - fixed wrong references (The file on the left (right) -> actual file name) - divided an example snippet of three files into separate files --HG-- extra : transplant_source : N0%87%F3%B0%B3W%C5%D6%B93%01T%AB%14%E0%CF%A7%B79 --- diff --git a/docs/src/userguide/sharing_declarations.rst b/docs/src/userguide/sharing_declarations.rst index 18ca42b..8ff2c2b 100644 --- a/docs/src/userguide/sharing_declarations.rst +++ b/docs/src/userguide/sharing_declarations.rst @@ -73,8 +73,8 @@ statement:: 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 -C data type. The file on the right is an implementation file which imports and +Here is an example. :file:`dishes.pxd` is a definition file which exports a +C data type. :file:`restaurant.pxd` an implementation file which imports and uses it. :file:`dishes.pxd`:: @@ -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. Here's an example: -:file:`c_lunch.pxd` :: +:file:`c_lunch.pxd`:: cdef extern from "lunch.h": void eject_tomato(float) -:file:`lunch.pyx` :: +:file:`lunch.pyx`:: cimport c_lunch @@ -205,14 +205,16 @@ definition part, and may not add any further C attributes. It may also define Python methods. Here is an example of a module which defines and exports an extension type, -and another module which uses it.:: - - # Shrubbing.pxd +and another module which uses it: + +:file:`Shrubbing.pyd`:: + cdef class Shrubbery: cdef int width cdef int length - - # Shrubbing.pyx + +:file:`Shrubbing.pyx`:: + cdef class Shrubbery: def __cinit__(self, int w, int l): self.width = w @@ -221,8 +223,8 @@ and another module which uses it.:: def standard_shrubbery(): return Shrubbery(3, 7) +:file:`Landscaping.pyx`:: - # Landscaping.pyx cimport Shrubbing import Shrubbing