Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > by-pkgid > 1a52c27bfef57af124a82326839f87e6 > files > 130

python-pyrex-0.9.8.5-3mdv2010.0.noarch.rpm

#
#  Example of an extension type.
#

cdef class Spam:

  cdef int amount

  def __new__(self):
    self.amount = 0

  def __dealloc__(self):
    print self.amount, "tons of spam is history."

  def get_amount(self):
    return self.amount

  def set_amount(self, new_amount):
    self.amount = new_amount

  def describe(self):
    print self.amount, "tons of spam!"