On Wed, May 27, 2009 at 6:15 AM, OUARDA MEHDI <[email protected]> wrote:
>
> 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)
>
>

No, No, please!!! That 'Exception' class in mpi4py code actually hides
the built-in "Exception". This is a really bad thing, but as I'm
following the MPI C++ bindings very closely, I did things like that.

In short, just do what you already did. Anyway, I agree with Dag's
comments, you should not need to use a cdef class for exceptions.

> ps: 'cause there is always one
>       is there any way to find an equivalent of abstractproprety,
> abstractmethod for *.pyx modules.that would be really helpful.
>       finallly, yes indeed...i meant python 2.6 (newbie mistake ;-)
>

Py2.6 'abstractproperty' will likely work, though 'abstractmethod' likely not...

If you can post a minimal (please, really minimal) example of what do
you want to do, perhaps I could give you a recipe. After that, I may
ask you to contribute by posting the recipe to the Cython wiki ;-)

>
>> Date: Tue, 26 May 2009 17:51:53 -0300
>> From: [email protected]
>> To: [email protected]
>> Subject: Re: [Cython] cython code optimisation...misc
>>
>> 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
>
> ________________________________
> Vous voulez savoir ce que vous pouvez faire avec le nouveau Windows Live ?
> Lancez-vous !
> _______________________________________________
> Cython-dev mailing list
> [email protected]
> http://codespeak.net/mailman/listinfo/cython-dev
>
>



-- 
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