summaryrefslogtreecommitdiff
path: root/docs/examples/userguide/extension_types/penguin2.pyx
blob: 726aeef8eeb0f40dc93f77d73c66f5fcf6170432 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
cimport cython


@cython.freelist(8)
cdef class Penguin:
    cdef object food
    def __cinit__(self, food):
        self.food = food

penguin = Penguin('fish 1')
penguin = None
penguin = Penguin('fish 2')  # does not need to allocate memory!