summaryrefslogtreecommitdiff
path: root/docs/examples/userguide/extension_types/penguin2.py
blob: 063563d16923f31d0d1aaa482721cb662acbb8e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
import cython

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

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