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

@cython.cclass
class Penguin:
    food: object

    def __cinit__(self, food):
        self.food = food

    def __init__(self, food):
        print("eating!")

normal_penguin = Penguin('fish')
fast_penguin = Penguin.__new__(Penguin, 'wheat')  # note: not calling __init__() !