5 ms·
Script type="text/python"
- icey 16y agoVery cool. I might be mistaken, but it looks like this requires Silverlight to function.
- ignu 16y agoThis is really a stretch to call this "client side" scripting when Silverlight is doing all the heavy lifting. It's a fun toy, but why an extra layer of abstraction when JavaScript + jQuery are crazy powerful.
- pufuwozu 16y agoThere was a bit of talk a while back about integrating Moonlight (open-source implementation of Silverlight) into Firefox itself. 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.
- daeken 16y agoSilverlight runs client side, so I don't really know why you're putting scarequotes around that. It's like saying that Flash games aren't running "client side".
- sp332 16y ago.Net has a standard library, that's why.
- Groxx 16y agoAnd a 200mb installer.
- xpaulbettsx 16y agoSilverlight's installer is 4MBish...
- Groxx 16y agoAnd the .Net installer? If you're using the .Net standard library, it's reasonable to assume .Net is a prerequisite. http://www.west-wind.com/weblog/posts/292203.aspx http://www.west-wind.com/weblog/posts/292203.aspx
- budgi3 16y agoLooks this has now been addressed with .Net 4.0. It's back down to 48MB.
- ttrashh 16y agoSilverlight contains a large subset of the .Net Framework in that 5Mb install. You don't need (and it can't use) the full .Net Framework.
- Groxx 16y agoDidn't know that, thanks! 5mb is indeed quite reasonable.
- ahlatimer 16y agoI'm writing an in-browser IDE for Python. Having a Python interpretor in the browser is incredibly useful for that.
- petercooper 16y agoSimilar but for Ruby: http://www.rubyinside.com/ironruby-silverlight-ruby-in-browser-3192.html http://www.rubyinside.com/ironruby-silverlight-ruby-in-brows...
- ekiru 16y agoThis apparently relies on Silverlight to work. That's fine, but it would nice if pages using it gave some indication why nothing happens if you don't Silverlight. The only reason I know that the problem is lack of Silverlight is from the other HN comments. That is decidedly not user-friendly.
- Goosey 16y agoIt is a bold first step. I sincerely hope Microsoft includes this functionality standard in the next release of IE. It would be refreshing to see them pushing innovation on the browser front. 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.
- alexdong 16y agoSilverlight is a concern but this does point to an interesting future. Image the main browser engines can expose c-binding of the equivalent javascript method/objects. Then we can have something very interesting like: <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>
- sesqu 16y agoI can see the whitespace actually being a problem here, since most tools assume they can rearrange it willy-nilly, and since indentation in html is generally speaking akin to washing your hands after you use the bathroom: a lot of people don't do it.
- afhof 16y agoI wouldn't mind seeing Python become the default scripting language for browsers over Javascript. Not that IronPython has to be the implementation. Python has a huge library and an easy learning curve.
- postfuturist 16y agoI love Python, I really do, but JavaScript happens to be slightly better as a browser language because it is a little freer with the anonymous functions. Most JavaScript programmers use this all the time, without even thinking. Here's a jQuery example: $.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.
- statictype 16y agoI'm interested in how much of a performance boost you get in running your code through Silverlight as opposed to the browser's javascript engine. Today, all the major browsers have heavily optimized javascript VMs so it might be a close contest
- mace 16y agoI think Skulpt (http://news.ycombinator.com/item?id=747086 http://news.ycombinator.com/item?id=747086) has more potential and is more interesting.
- Raphael_Amiard 16y agoWhile i find this cool,and putting aside the fact that it's a Microsoft specific extension since this is covered in other comments, i really doubt of the utility of python as a client side language. 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 ?
- deleted 16y ago[deleted]
- edanm 16y agoThe simplest answer for me is that I know Python very well, but don't know Javascript (that was more true when I just got started with web programming a few months ago). If I could use Python in the browser, I would: one less thing to learn. Especially since my (server-side) application is written in Python/Django, it makes even more sense. 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.
- Flow 16y agoIt's just as bad and short-sighted as type="text/vbscript".
- CWIZO 16y agoDoesn't this complicate HTML minification as you can't minify whatever is inside the python script tag? And you can't minify external .py files also ...
- Yaggo 16y agoIf you want to compress your script, gzipping makes much more sense than minification.
- pornel 16y agoIt shouldn't be a problem for a good minimizer (that checks script type). However, if you're loading whole Python interpreter via Silverlight, script minimization is least of your problems.