Hi
Here's a couple of problems.
(1) As present, at least one of the py -> js produces JavaScript with excess parentheses. This reduces readability.
(2). I'd expect "a, b = 1, 2" to produce "a = 1; b = 2", possibly with var declarations. I get something more complcated and, more important, the var declarations are missed off.
I know the bug in (2) can be fixed with some work, but how can we be sure that there are no other similar bug lurking in the code?
py2js-github$ python -i py2js.py
Usage: py2js.py [options] filename
Python to JavaScript compiler.
Options:
-h, --help show this help message and exit
--include-builtins include py-builtins.js library in the output
>>> convert_py2js('1+a')
'(1)+(a);'
>>> convert_py2js('a, b = 3, 4;')
'var __dummy0__ = tuple([3, 4]);\na = __dummy0__.__getitem__(0);\nb = __dummy0__.__getitem__(1);'
>>> convert_py2js('a =1 ; b = 2')
'var a = 1;\nvar b = 2;'
>>>
--
Jonathan
--
You received this message because you are subscribed to the Google Groups "JavaScript for Python programmers" group.
To post to this group, send an email to
js...@googlegroups.com.
To unsubscribe from this group, send email to
js4py+un...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/js4py?hl=en-GB.