Show HN: Py2many – Transpile Python3 to 7 languages
github.com
github.com
https://github.com/adsharma/py2many/tree/main/tests/cases https://github.com/adsharma/py2many/tree/main/tests/expected
100x speedup on this benchmark
http://www.hildstrom.com/projects/langcomp/index.html#test-p...
py2many.py --rust=1 test.py
rustc -O test.rs
$ time -p ./test.py
iterations 3
sum 1.4999999709476166e+17
real 436.55
user 435.45
sys 1.08
$ time -p ./test 3
iterations 3
sum 1.500000E+17
real 4.94
user 4.67
sys 0.25Also, just wondering how modular it is. How hard would it be to add another target, say Javascript?
JavaScript is possible via python to dart to JavaScript.
Adding another backend is easy, given there are 7 backends already.
Are dicts ordered? Not by default. It should be possible to translate Python's ordereddict to one in the target language.
Just mapping max/min was hard enough. In some languages max(1,2) produces a float!
E.g. https://mail.python.org/pipermail/python-dev/2017-December/1...
From an implementation perspective, doing it for the ordereddict special case is much simpler.
https://github.com/adsharma/py2many/pull/204
Also added this benchmark as a test case, so we don't regress.
Bringing it to the same level as other languages is probably several weeks of work. Pull requests welcome.
Please add details if any