Calling Python from Javascript?

John J. Lee jjl at pobox.com
Thu Apr 12 00:07:40 CEST 2007


jjl at pobox.com (John J. Lee) writes:

> Kenneth McDonald <kenneth.m.mcdonald at sbcglobal.net> writes:
> 
> > I know that there's some work out there to let Python make use of
> > Javascript (Spidermonkey) via (I assume) some sort of bridging C/C++
> > code. Anyone know of efforts to allow the reverse? I'd really like to
> > make use of Python when doing Mozilla DOM programming, and I can never
> > get a clear idea of when PyXPCOM might be available to those of us who
> > don't know the ins and outs of compiling Mozilla, and its XPCOM
> > structures. So if there was an easy way to simply and quickly pass
> > even just strings back and forth between Python and Moz Javascript,
> > that would make certain things a heck of a lot easier.
> 
> I too wonder what happened to Mark Hammond's work on the
> DOM_AGNOSTIC_2 branch a year or so back.  Might be nice to be able to
> write Firefox extensions in Python.
> 
> Practically, I know that e.g. the firefox htmltidy extension (I forget
> the name) contains binaries built from C code, not just JS, so I guess
> you could write a Firefox extension that embeds CPython in a similar
> way.

There are also some compilers for generating JS from Python (or
Python-like) source.  The pyjamas project has one (pyjamas is
currently a port of GWT to Python), and I believe PyPy has a JS
backend too.  Both of those are serious work but experimental.


John



More information about the Python-list mailing list