[Cython] [RFE] Add dummy compiler directive decorators for pure python mode
Carlos Pita
carlosjosepita at gmail.com
Sat Jul 25 15:23:33 CEST 2015
> > Not sure, but would it be desirable for the decorators to be less dummy and
> > for RuntimeCompiledFunction to take the flags into account when compiling
> > on the fly?
>
> Can you provide a pull request, including tests?
I don't have much time these days but I gave some thoughts to this and I
would like to hear your opinion about the following proposal before start
coding:
1. The compiler-directives, locals, etc. decorators will be less dummy in
two ways:
- They will know how to print a repr of themselves.
- They will register themselves under some "private" attribute (say
_cython_decorators, do you have any preference here?) of the decorated function.
2. Besides get_body(f), RuntimeCompiledFunction will use a new function
get_cython_decorators(f), which returns the concatenated repr of the
registered decorators.
3. This block of code will be passed as a new argument (say
cython_decorators) to cython_inline. The module code template will now be:
module_code = """
%(module_body)s
%(cimports)s
%(cython_decorators)s
def __invoke(%(params)s):
%(func_body)s
"""
What do you think?
Cheers
--
Carlos
More information about the cython-devel
mailing list