Attachment 'cython_demo.patch'

Download

   1 # HG changeset patch
   2 # User Robert L. Miller <[email protected]>
   3 # Date 1202416167 28800
   4 # Node ID b54a0c111dea412221f829339add9b27e94ed1f6
   5 # Parent  7994ac1af415700517c8e95a384df1e2c2ca611b
   6 Toy example of making a cython extension to Sage.
   7 
   8 diff -r 7994ac1af415 -r b54a0c111dea sage/hello_world/__init__.py
   9 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
  10 +++ b/sage/hello_world/__init__.py	Thu Feb 07 12:29:27 2008 -0800
  11 @@ -0,0 +1,1 @@
  12 +
  13 diff -r 7994ac1af415 -r b54a0c111dea sage/hello_world/hello.pyx
  14 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
  15 +++ b/sage/hello_world/hello.pyx	Thu Feb 07 12:29:27 2008 -0800
  16 @@ -0,0 +1,5 @@
  17 +def foo():
  18 +    cdef int i, j = 0
  19 +    for i from 0 <= i < 10:
  20 +        j += i
  21 +    print "Hello, %d"%j
  22 diff -r 7994ac1af415 -r b54a0c111dea setup.py
  23 --- a/setup.py	Sat Feb 02 17:52:45 2008 -0800
  24 +++ b/setup.py	Thu Feb 07 12:29:27 2008 -0800
  25 @@ -877,6 +877,10 @@ ext_modules = [ \
  26                ['sage/graphs/graph_isom.pyx']
  27                ), \
  28  
  29 +    Extension('sage.hello_world.hello',
  30 +              ['sage/hello_world/hello.pyx']
  31 +              ), \
  32 +
  33      Extension('sage.graphs.bruhat_sn',
  34                ['sage/graphs/bruhat_sn.pyx']
  35                ), \
  36 @@ -1162,6 +1166,8 @@ code = setup(name        = 'sage',
  37                       
  38                       'sage.graphs',
  39                       
  40 +                     'sage.hello_world',
  41 +                     
  42                       'sage.groups',
  43                       'sage.groups.abelian_gps',
  44                       'sage.groups.matrix_gps',

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.

You are not allowed to attach a file to this page.