Script type="text/python"
ironpython.net
ironpython.net
I can see Firefox following suite. Just embed CPython and route it through that; given that they are struggling to match the Javascript performance of V8 it seems they might welcome a free diversion.
Chrome following suite is more questionable. V8 is the current king of the ring in JS performance, but Google is widely known to be a supporter of Python. I can imagine them amiable to the idea of unifying their server side glue with the client. Besides; they have shown time and time again to make 'strategically strange' moves in order to help advance the general state of the internet. When it comes to google if the internet wins, they win.
Opera would be wise to support it as a differentiating feature. They need all the tricks they can pull to stay relevant.
The bugaboo to me is Apple. They have Nitro, which is right up with V8 in most benchmarks, and support for languages which have benevolent dictators living in their enemy's quarters doesn't sound like an Appleish thing to do. I doubt they would peacefully hand over any control.
Of course if we do stumble into a multi-client-side-language-choice Renaissance it will be Adobe with the most to lose.
The runtime API they present to python though, while it seems to be just the DOM exposed, would still need to be documented and standardized.
I imagine that, from a security standpoint, embeding CPython in a browser would be pretty hairy.
The only advantage i can see is language homogenization between server and client code, if your web app is in python. Python doesn't have a sane syntax for anonymous functions, which i use a lot in event driven code because imho they make the code clearer. That's arguably a small drawback, but the advantages also seems scarce from my perspective.
Of course there are python niceties like list comprehensions, but i would much rather use CoffeeScript if i need a step up in syntax from Javascript, since it has very nice support for anonymous functions, and a whole lot of other things, being designed precisely for this purpose.
What do you guys think ? Why would you like to use python scripts ?
I also consider Python a great language, and am usually happier in it than any other language. It's nicer than Javascript is, at least in my (limited) experience.
<script type="text/python" src="http://www.feedparser.org/feedparser.py/>
<script type="text/python">
for item in feedparser('http://techcrunch.com/rss.xml):
doc['feed'].append("<a href=\"%s\">%s</a>" % (item.link, item.title))
</script>$.ajax({ url: 'ajax/test.html', success: function(data) { $('.result').html(data); alert('Load was performed.'); } });
The equivalent Python would be this (assuming you ported jQuery):
def successcb(data): Q('.result').html(data) alert('Load was performed
Q.ajax(url='ajax/test.html', success = successcb)
OK, that's not too bad, I guess. Named parameters are nice. Having to define the success callback separately is not so great.
Edit, HN broke the formatting.
Today, all the major browsers have heavily optimized javascript VMs so it might be a close contest
It's a fun toy, but why an extra layer of abstraction when JavaScript + jQuery are crazy powerful.
I'm not sure whether it was decided to be infeasible but I really liked the thought of having a general purpose VM available directly within the browser.
However, if you're loading whole Python interpreter via Silverlight, script minimization is least of your problems.