Alternative syntax for blocks with decorator and context manager
Created originally on Bitbucket by paugier (Pierre Augier)
I'd like to support such things:
from transonic import with_blocks, block @with_blocks def func(arg: int): a = non_pythranizable(arg) with block(): a: float tmp = a + arg return non_pythranizable(tmp)
I think supporting
return in a block is going to be difficult.
from transonic import boost, with_blocks, block @boost class MyClass: attr0: int @with_blocks def func(self, arg: int): a = non_pythranizable(arg) with block(): a: float tmp = a + arg + self.attr0 return non_pythranizable(tmp)
- We could also support block signatures
# transonic block (int: a, b; A: c, d, e)in the block.