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