cdef cypclass SomeMemory: int a SomeMemory __new__(f): o = f() o.a = -2 return o void* __new__(f, int a): o = f() o.a = a return <void*> o double __new__(unused, int a, double b): return a*b SomeMemory __new__(f, int a, int b, int c=2, int d=4, int e = 32, int g = 65): o = f() return o SomeMemory __alloc__(): return new SomeMemory() void __init__(self): this.a += 1 void __init__(self, int a): pass void __init__(self, int a, int b, int c, int d = 21, int e = 31): self.a = e cdef int foo(): cdef SomeMemory o = SomeMemory() return o.a cdef int bar(): cdef SomeMemory o = SomeMemory(3) return o.a cdef int baz(): o = SomeMemory(3, 2, 1, 0) return o.a cdef double baa(): o = SomeMemory.__new__(SomeMemory.__alloc__, 2, 3.4) o = SomeMemory.__new__(NULL, 2, 3.4) return o cpdef bag(): return str(foo()) + '\n' + str(bar()) + '\n' + str(baz()) + '\n' + str(baa())