On Oct 9, 2007, at 4:16 PM, David Binger wrote: >> > Note that both notations are syntax errors for the ordinary >> > Python compiler, and this is essential, since it would be >> > very bad to have templates accidentally compiled with the >> > wrong compiler. >> >> Is this really true? It would be a pity... Is it at all technically >> possible (however complex) to not deviate at all from standard python >> syntax, i.e. .qpy files become normal .py files, and a regular python >> decorator can process the function code body to return another >> function? Is >> there a limitation I am not aware of? > > The only possibility I can think of would be to have the decorator > actually replace the code > object of the function it decorates with a modified code object. Regular decorator functions is where my thinking was going also. My first concern with that is that it would incur a performance penalty with the functions being rewritten every time the module is loaded. I.e. not once when the source file is compiled to a .pyc. This could prove to be troublesome for large applications. What if the decorator function was primarily a NOOP and just used to identify which functions/methods qpy will templatize? I.e. if a function/method is wrapped with a particular decorator from the qpy module, then it gets templatized during compilation. The decorator could also check to make sure that the function/method had indeed by templatized and throw an exception if not. Would this allow files to end in .py? Dave This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and delete and destroy all copies of the original message.