`int` -> `cdef int` when declaring local variables in early binding example.
authorW. Trevor King <wking@drexel.edu>
Thu, 17 Feb 2011 12:57:11 +0000 (07:57 -0500)
committerRobert Bradshaw <robertwb@math.washington.edu>
Thu, 17 Feb 2011 21:24:42 +0000 (13:24 -0800)
src/userguide/early_binding_for_speed.rst

index 07e0047aa19e68fcb0d4ce0e750a8d9e81ed3d02..d44498ddf87a28e796f9a600ddab4e65cd286d9d 100644 (file)
@@ -53,7 +53,7 @@ where calls occur within Cython code. For example:
         def __init__(self, int x0, int y0, int x1, int y1):
             self.x0 = x0; self.y0 = y0; self.x1 = x1; self.y1 = y1
         cdef int _area(self):
-            int area
+            cdef int area
             area = (self.x1 - self.x0) * (self.y1 - self.y0)
             if area < 0:
                 area = -area
@@ -88,7 +88,7 @@ overheads. Consider this code:
         def __init__(self, int x0, int y0, int x1, int y1):
             self.x0 = x0; self.y0 = y0; self.x1 = x1; self.y1 = y1
         cpdef int area(self):
-            int area
+            cdef int area
             area = (self.x1 - self.x0) * (self.y1 - self.y0)
             if area < 0:
                 area = -area