Wednesday, April 15, 2009

Notes about Cython classes

Just my own personal Notes for my own reference

In cython the are 2 different types of classes

Normal python classes as in the form

class A(object):
pass

Cython classes
cdef class A :
cdef int someterm

cython classes do not have a __dict__ to store their attributes in.
that is why they are so fast
but the concequence is that you can not add attributes at runtime like you can with normal python classes.
If you peak into the source code generated by cython you see they are actually structs.

No comments:

Post a Comment