merged in latest cython-devel
[cython.git] / Demos / spam.pyx
1 #
2 #  Example of an extension type.
3 #
4
5 cdef class Spam:
6   cdef public int amount
7
8   def __new__(self):
9     self.amount = 0
10
11   def __dealloc__(self):
12     print self.amount, "tons of spam is history."
13
14   def get_amount(self):
15     return self.amount
16
17   def set_amount(self, new_amount):
18     self.amount = new_amount
19
20   def describe(self):
21     print self.amount, "tons of spam!"