transonic.dataclass for numba.jitclass and cython cdef class
Created originally on Bitbucket by paugier (Pierre Augier)
from transonic import dataclass, boost
@dataclass
class MyStruc:
attr: int
def compute(self, arg: int):
return self.attr + arg
def modify(self, arg: int):
self.attr = arg
@boost
def func(o: MyStruct, a: int):
o.modify(a)
return o
@boost
def func1(o: MyStruct, a: int):
return o.compute(a)
See https://github.com/serge-sans-paille/pythran/issues/1116
and what is done in https://github.com/ogrisel/pygbm/blob/master/pygbm/splitting.py#L21