1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
__doc__ = """
>>> s = Spam()
>>> s.get_tons()
17
>>> s.set_tons(42)
>>> s.get_tons()
42
"""
import platform
if not hasattr(platform, 'python_implementation') or platform.python_implementation() == 'CPython':
__doc__ += """
>>> s = None
42 tons of spam is history.
"""
cdef class Spam:
cdef int tons
def __cinit__(self):
self.tons = 17
def __dealloc__(self):
print self.tons, u"tons of spam is history."
def get_tons(self):
return self.tons
def set_tons(self, x):
self.tons = x
|