Convert all experiments to use code generation; make generated functions picklable.
Loading
-
-
Neat. I was not aware of this. I don't think that's the first time I've re-invented something that you first wrote.
It would be nice to be able to use
pymbolic.compiler
instead of my giant hack, but currently there are two issues:-
compile()
doesn't like variables like<dt>
>>> from pymbolic import compile, var >>> compile(var("<dt>")) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.7/site-packages/pymbolic/compiler.py", line 117, in __init__ self._compile() File "/usr/local/lib/python2.7/site-packages/pymbolic/compiler.py", line 141, in _compile self.__call__ = eval(func_s, ctx) File "<string>", line 1 lambda <dt>: <dt> ^ SyntaxError: invalid syntax
-
compile()
doesn't like variables that are also keywords
>>> compile(var("lambda")) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.7/site-packages/pymbolic/compiler.py", line 117, in __init__ self._compile() File "/usr/local/lib/python2.7/site-packages/pymbolic/compiler.py", line 141, in _compile self.__call__ = eval(func_s, ctx) File "<string>", line 1 lambda lambda: lambda ^ SyntaxError: invalid syntax
-
Please register or sign in to comment