On Tue, May 26, 2009 at 11:35 AM, OUARDA MEHDI <[email protected]> wrote:
> hello,
> in fact I'm rewriting (in cython 2.6)  a python code of a simulator in order
> to optimize the slowest functions.

Did you mean Python 2.6?

> i've a couple of questions....
> is there any equivalent of abstractproprety, abstractmethod in cython ?and
> how to use it

Are talking about the new ABC stuff in Py2.6/3.0? Mmm... not sure if
they will work.

> is there any way to inherit from builtin classes in cython like class
> Exception?... any trick to do something equivalent will be welcome
> here is an exemple:
> class DuplicateNameError(Exception):
>     pass
> when i define my class as cpdef... an error occurs while compiling...here is
> the message i get:
> /home/tenninos/stage/arboris-python/src/misc.pyx:19:6: 'Exception' is not a
> type name building 'misc' extension
>

Do you really need your exceptions to be cdef classes? That would not
work on Py < 2.5... Anyway (perhaps being compatible with older Python
is not an issue for you), look the first lines of this code, that
should work. Disclaimer: I've not tested this for some time, that code
is there just for reference, I'm not currently using it in my project
just because of the compatibility with Py2.3 and Py2.4:

http://code.google.com/p/mpi4py/source/browse/trunk/src/MPI/ExceptionC.pyx


-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to