Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Here is what worked for me. First I create a file:

/home/mike/cython.spyx

with the following contents:

cdef class c_class:

cdef int number

def __init__(self, n):
    self.number = n

cpdef show(self):
    print('The number was: %s' %self.number)

Then I start up sage:

sage: version()

'Sage Version 4.5.1, Release Date: 2010-07-19'

sage: load '/home/mike/cython.spyx'

Compiling /home/mike/cython.spyx...

sage: instance = c_class(5)

sage: instance.show()

The number was: 5

-- I hope this is readable. This is the first question I've tried to answer and I'm having a little trouble with the formatting :-)

-Mike

Here is what worked for me. First I create a file:

/home/mike/cython.spyx

with the following contents:

cdef class c_class:

cdef class c_class:
    cdef int number
  def __init__(self, n):
     self.number = n
  cpdef show(self):
    print('The number was: %s' %self.number)

Then I start up sage:

sage: version()

version() 'Sage Version 4.5.1, Release Date: 2010-07-19'

2010-07-19' sage: load '/home/mike/cython.spyx'

'/home/mike/cython.spyx' Compiling /home/mike/cython.spyx...

/home/mike/cython.spyx... sage: instance = c_class(5)

c_class(5) sage: instance.show()

instance.show() The number was: 5

5

-- I hope this is readable. This is the first question I've tried to answer and I'm having a little trouble with the formatting :-)

-Mike

Here is what worked for me. First I create a file:

/home/mike/cython.spyx

with the following contents:

cdef class c_class:
    cdef int number
    def __init__(self, n):
        self.number = n
    cpdef show(self):
     print('The number was: %s' %self.number)

Then I start up sage:

sage: version()
'Sage Version 4.5.1, Release Date: 2010-07-19'
sage: load '/home/mike/cython.spyx'
Compiling /home/mike/cython.spyx...
sage: instance = c_class(5)
sage: instance.show()
The number was: 5

-- I hope this is readable. This is the first question I've tried to answer and I'm having a little trouble with the formatting :-)

-Mike