New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hy2py generates invalid Python #923
Comments
@tmbdev This is known and intentional. |
I wonder if we could add a switch to the tool to make it convert all the identifiers to their punycode equivalents? Would that be enough to make all the output valid Python? |
@gilch |
In #934 @kirbyfan64 pointed out that Cython uses a custom parser, so it needs source code, not just a compiled module. Hy doesn't support Cython's type annotations, but you supposedly get considerable speedup even without them. If you just imported a Hy module from a Cython program, there wouldn't be any speedup for the Hy module, but if hy2py could generate valid Python, then you could compile that output with Cython and get the speedup. I also wonder about Pyjamas, which lets you run Python in the browser. It's supposed to generate JavaScript from Python AST, but they're probably making assumptions about it containing valid Python identifiers. I haven't actually tried it, but I don't think Hy would work. But if hy2py could generate valid Python, then you could translate that output to JavaScript using Pyjamas, and use Hy in the browser. |
Closing this. @gilch feel free to make a new issue about the switch idea \o/ |
Running hy2py generates invalid Python output:
I think this should either quote or give an error at compilation time.
The text was updated successfully, but these errors were encountered: