Dear Cython team,

hopefully the following really is a cython-question, not a Sage-question.

Write a file Problem.pyx:

ctypedef struct Term_t:
    long coef

cdef class Term:
    cdef Term_t Data
    def __init__(self, c):
        self.Data.coef = c
    def coefficient(self):
        return self.Data.coef


Start Sage and do
 sage: attach Problem.pyx
 sage: T=Term(3)
 sage: type(T.coefficient())

Then the result is 
 <type 'int'>
and *not* <type 'long'>!

Why is it of type 'int' although coef is defined 'long' in Term_t? How can 
i avoid this automatic down-grading of coef?

I really want coef to be of type 'long', since 'int' isn't good enough in 
my application.

Yours
        Simon
 
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to