473,774 Members | 2,218 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Python on JavaScript VM's (such as V8)?

I wonder what it would take to implement Python in JavaScript so it
can run on those fancy new JavaScript VM's such as Chrome's V8 or
Firefox' tracemonkey. Much the same as Python implementations in C#
(IronPython) and Java (Jython). It would certainly bring back the fun
in web application development. Is there anything done in that
direction?

2B
Sep 3 '08 #1
4 2462
Berco Beute:
I wonder what it would take to implement Python in JavaScript so it
can run on those fancy new JavaScript VM's such as Chrome's V8 or
Firefox' tracemonkey. Much the same as Python implementations in C#
(IronPython) and Java (Jython). It would certainly bring back the fun
in web application development. Is there anything done in that
direction?
The mythical beast pypy is supposed able to translate Python to
Javascript too, I think. From some of my benchmarks Chrome's V8 is a
little slower than Psyco... so the matter is how much efficiently can
be Python translated in JS.

Bye,
bearophile
Sep 3 '08 #2
On Sep 3, 10:02 pm, bearophileH...@ lycos.com wrote:
Berco Beute:
I wonder what it would take to implement Python in JavaScript so it
it's been done. http://pyjamas.sf.net
can run on those fancy new JavaScript VM's such as Chrome's V8 or

that's been done, too.

http://advogato.org/article/985.html
Firefox' tracemonkey. Much the same as Python implementations in C#
(IronPython) and Java (Jython). It would certainly bring back the fun
in web application development.
it's great :) been using it just for fun, for about 18 months.
http://lkcl.net/site_code
and for a personal project
http://partyliveonline.com
and for a commercial project which i'm sorry i can't refer you to the
development site right now.

Is there anything done in that direction?
yup. quite a lot.
see http://groups.google.com/groups/pyjamas-dev
The mythical beast pypy is supposed able to translate Python to
Javascript too, I think. From some of my benchmarks Chrome's V8 is a
little slower than Psyco... so the matter is how much efficiently can
be Python translated in JS.
well, the llpamies pyjamas branch from sep 2007 has some definite
improvements in the _features_ provided (python-wise) but some time
after that, one too many interoperabilit y features were added (proper
support for **kwargs) and it just... blew up, got too complicated for
luiz and he abandoned the effort.

i've outlined on pyjamas-dev what work needs to be done to satisfy
both goals of remaining efficient and also providing support for
**kwargs.

one _much_ more important requirement - over-and-above
"efficiency " (which isn't that bad anyway in pyjs.py) is readability.

remember you have to _debug_ these xxxxing programs .... in
javascript, not python (which is why i did pyjamas-desktop - http://pyjd.sf.net
so you could keep on using the standard python interpreter and _then_
run the same app through pyjs.py to convert it to javascript).

l.
Oct 2 '08 #3
On Oct 2, 1:06*pm, lkcl <luke.leigh...@ googlemail.comw rote:
On Sep 3, 10:02 pm, bearophileH...@ lycos.com wrote:
Berco Beute:
I wonder what it would take to implement Python in JavaScript so it

*it's been done. *http://pyjamas.sf.net
That's hardly an implementation of Python in Javascript - it's a
partial Python to Javascript translator.

Still looks good though.

Michael
--
http://www.ironpythoninaction.com/
Oct 7 '08 #4
On Oct 7, 10:15 pm, Fuzzyman <fuzzy...@gmail .comwrote:
On Oct 2, 1:06 pm,lkcl<luke.le igh...@googlema il.comwrote:
On Sep 3, 10:02 pm, bearophileH...@ lycos.com wrote:
Berco Beute:
I wonder what it would take to implement Python inJavaScriptso it
it's been done. http://pyjamas.sf.net

That's hardly an implementation of Python inJavascript-
someone _is_ considering validating the pyjs.py interpreter to ensure
that it's NP complete. however, it's an academic exercise that's not
driven by an actual real-world need.

basically, running pyjs.py and the standard python 2.5 "compile"
module under pyv8. just for kicks :)

so, the beginnings of the process - to bootstrap your way entirely
into javascript-land, where you'd be able to "input" python and have
it compiled _to_ javascript _by_ a python-to-javascript compiler which
_itself_ has been compiled to javascript - the foundations have been
laid.

and it's not _as_ crazy as it sounds. sufficient tests to demonstrate
unequivocably that the equivalent javascript _is_ equivalent; you then
have pyv8 empirically demonstrating a ten times - TEN times for
goodness sake - performance increase - that's got to be worth it.

especially if it can be done "automagically" , behind the scenes, so
that when you type "python myapp.py" instead of executing forth-like
byte code (myapp.pyc) you "execute" javascript (myapp.pyj).

it's a
partial Python toJavascripttra nslator.
compiler. python to javascript _compiler_ :)

with a more complete python-to-javascript compiler in http://code.google.com/p/pyjamas
subversion - you'll need the llpamies branch, but you'll _also_ need
to go back to around sep 2007. somewhere in between then and now,
luis tried to add proper support for **kwargs and he didn't complete
it.

Still looks good though.
yeh :)

Oct 13 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

46
6290
by: Jon Perez | last post by:
Can one run a 1.5 .pyc file with the 2.x version interpreters and vice versa? How about running a 2.x .pyc using a 2.y interpreter?
24
3451
by: Richard Blackwood | last post by:
Is it possible to prototype an operating system in Python? If so, what would such a task entail? (i.e. How would one write a boot-loader in Python?) - Richard B.
34
6434
by: Ville Voipio | last post by:
I would need to make some high-reliability software running on Linux in an embedded system. Performance (or lack of it) is not an issue, reliability is. The piece of software is rather simple, probably a few hundred lines of code in Python. There is a need to interact with network using the socket module, and then probably a need to do something hardware- related which will get its own driver written in C.
118
6743
by: 63q2o4i02 | last post by:
Hi, I've been thinking about Python vs. Lisp. I've been learning Python the past few months and like it very much. A few years ago I had an AI class where we had to use Lisp, and I absolutely hated it, having learned C++ a few years prior. They didn't teach Lisp at all and instead expected us to learn on our own. I wasn't aware I had to uproot my thought process to "get" it and wound up feeling like a moron. In learning Python I've...
8
1389
by: chewie54 | last post by:
Hi All, I have read some posts on this subject but I haven't been able to make a decision whether to use Python or not. I'm considering converting a Java CAD program to Python/C with wxWdigets for the GUI. I don't have good answers for:
57
2718
by: dongie.agnir | last post by:
I'm pretty new to Python, and even newer to Image/Video processing, and trying to get started on a project similar to GRL Vienna's laser marker. I found some sample code here http://janto.blogspot.com/2006/01/motion-capture-in-python.html, but after running the code with the included sample input file, it seems quite slow (1-2 seconds from start to finish to do the 800 by 600 gif image). Is there a better way to do color tracking, or is...
53
5257
by: Vicent Giner | last post by:
Hello. I am new to Python. It seems a very interesting language to me. Its simplicity is very attractive. However, it is usually said that Python is not a compiled but interpreted programming language —I mean, it is not like C, in that sense. I am working on my PhD Thesis, which is about Operations Research,
0
1169
by: Luke Kenneth Casson Leighton | last post by:
On Sep 3, 10:02 pm, bearophileH...@lycos.com wrote: 1200 lines of code for the compiler, and about... 800 for a basic suite of builtin types (Dict, List, set, string). http://pyjamas.sf.net so it's been done.
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10267
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10046
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8939
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7463
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6717
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4014
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3611
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.