summaryrefslogtreecommitdiff
path: root/docs/examples/userguide/extension_types/extendable_animal.pyx
blob: 417760efd160a1057a8b218a0adcf7d3cd291dc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 
cdef class Animal:

    cdef int number_of_legs

    def __cinit__(self, int number_of_legs):
        self.number_of_legs = number_of_legs


class ExtendableAnimal(Animal):  # Note that we use class, not cdef class
    pass


dog = ExtendableAnimal(4)
dog.has_tail = True