NodeJS and PythonJS

213 views
Skip to first unread message

Harts Antler

unread,
Nov 12, 2013, 3:18:13 AM11/12/13
to nod...@googlegroups.com
PythonJS is a Python to JavaScript translator like Brython, but produces faster output code than Brython, see this post.
PythonJS 0.8.4 now works with NodeJS, and includes special wrappers for it.

Sample Code:
from nodejs.io import *
from nodejs.sys import *

path = sys.argv[ len(sys.argv)-1 ]
f = open( path, 'rb' )
print f.read()

Angel Java Lopez

unread,
Nov 12, 2013, 6:10:21 AM11/12/13
to nod...@googlegroups.com
Thanks for the work, very impressive.

And detailed post, I see now the power of Python JS. Yes, Brython code tries to have globals, locals, to conform to Python sematic, but it is "too much".

My pet project:
- Compiling very reduced set of Python to JavaScript (written in JavaScript)
there are express sample apps (import http maps to require('http'))

I want to explore type inference, but in another pet project, trying to emulate RPython:
again, using JavaScript/Nodejs, this time translate Python to C. There is a primes.py working sample

I guess you can get the same from pure Python. Instead processing .pyc (I guess this is the strategy of PyPy), take the AST, inference types, and output C plain code. Even annotations in functions and arguments could help to type inference.

But I prefer JavaScript ;-)

Angel "Java" Lopez
@ajlopez






--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
 
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Dan Stromberg

unread,
Nov 18, 2013, 9:33:40 PM11/18/13
to nod...@googlegroups.com

Could you please look over http://stromberg.dnsalias.org/~dstromberg/pybrowser/python-browser.html and help me fill in the missing columns related to PythonJS?

Thanks!

Floby

unread,
Nov 20, 2013, 4:36:23 AM11/20/13
to nod...@googlegroups.com
This looks like a important gain in performance.
I'm surprised that the raw javascript version of your code examples doesn't show in your comparisons. This could be interesting.


Also, in the example you just gave for Python on the node.js platform, it doesn't show how to handle asynchronous operations which is the whole point of node ! If only synchronous methods are available, what are the benefits of running this in node rather than in the python interpreter? Similarily, even if asynchronous methods are available, what are the benefits of running this on node instead of using a framework like Twisted for Python?
Reply all
Reply to author
Forward
0 new messages