OUARDA MEHDI wrote:
> hi,
> thanks for the code... that helped me to compile the *.pyx
> module.however, i still missing something:
> i thought that cdef class can't inherit python objects(at least for py
> 2.6).however,if i could avoid defining my functions
> as cdef and it still works when using it with cython classes that
> would be ok for me...now the issue is this one, if i define my class like
> this:
> cdef extern from "Python.h":
> ctypedef class __builtin__.Exception [object PyBaseExceptionObject]:
> pass
>
> cpdef class DuplicatedNameError(Exception):
> pass
>
> when a DuplicatedNameError occurs, did it calls the python build in
> class Exeption or shall' i impliment my self the class Exception as
> in the expemle
> (http://code.google.com/p/mpi4py/source/browse/trunk/src/MPI/ExceptionC.pyx)
For exceptions I think it is very, very unlikely that you actually need
any cdef things at all. Can't you just use
class DuplicatedNameError(Exception):
def somefunc(self): ...
? There's no need to add types unless you have to :-), and for
exceptions one usually don't.
Dag Sverre
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev