Live data from Hacker News

Python, client side: Skulpt

skulpt.org

11–20 of 43 posts

Re: Python, client side: Skulpt

#12
In Opera 10 b2, the python shell never seems to grab focus correctly, so pressing space will scroll down the page way past it, making it very fiddly to use!

Along with hn user pmorici I'd like to find out what subset of Python this supports.

Re: Python, client side: Skulpt

#13
post #10
post #2

I just can't get myself to love JS the way I do other languages... so, this is my current little weekend project. It's a source-to-source translator so it interops reasonably with JS and should perform similarly also. The parser is derived from CPython's so that part is relatively complete, but the "backend" isn't done yet. For example, there's not even support for "class" yet.

What version of the language is this and what subset of stuff works, it seems like everything I try gives me some kind of error, maybe I'm just picking the wrong things. like it lets me create a dictionary but if I try to call the iterkeys() method it doesn't like that, and the built-in function dir() doesn't work. It has range() but not xrange()? Cool none the less.

The version is the "still lame" version where I haven't implemented those functions yet. :)

Parser-wise it's 2.6.2, but those functions you mention are in C code in real-Python, so I need to (re-)write them in JS. You can see the list of supported global functions and method functions if you grab the source off bitbucket.

(Incidentally, "for x in a_dict" will work the same as iterkeys currently)

Re: Python, client side: Skulpt

#14
post #12

In Opera 10 b2, the python shell never seems to grab focus correctly, so pressing space will scroll down the page way past it, making it very fiddly to use! Along with hn user pmorici I'd like to find out what subset of Python this supports.

Hrm, sorry about Opera. I tested in a few browsers, but I confess my browser-dom-fu is weak.

From the look of it I'm telling MooTools to stop that event, but backspace doesn't seem to stop in Opera either. Maybe they don't want people disabling keyboard navigation maliciously?

edit: re: subset, my intention is for source-level 2.6 compatibility with the core language, but that's definitely far away.

Re: Python, client side: Skulpt

#16
post #4
post #2

I just can't get myself to love JS the way I do other languages... so, this is my current little weekend project. It's a source-to-source translator so it interops reasonably with JS and should perform similarly also. The parser is derived from CPython's so that part is relatively complete, but the "backend" isn't done yet. For example, there's not even support for "class" yet.

Very impressive work. But you'll need to implement "import this" for it to be considered a serious Python implementation.

Good point

Re: Python, client side: Skulpt

#17
Doing the source-to-source translation on top of the javascript on the client side is quite neat.

I'd actually love to create a "GWT like" that would compile my python (in javascript/html/css) for the different browsers out there. That would be awesome.

GWT is nice and all, but python >> Java...

Re: Python, client side: Skulpt

#18
post #17

Doing the source-to-source translation on top of the javascript on the client side is quite neat. I'd actually love to create a "GWT like" that would compile my python (in javascript/html/css) for the different browsers out there. That would be awesome. GWT is nice and all, but python >> Java...

As snprbob86 pointed out, that already exists: Pyjamas @ pyjs.org.

I used pyjamas a while back for a couple toy projects. It's quite nice and sounds like what you're looking for.

With Skulpt, I wanted to avoid the build step that Pyjamas has (the compiler's written in Python, not Javascript so you run it ahead of time) and at least when I used it, it sometimes felt like Javascript with Python syntax, rather than actually programming in Python. It's certainly closer to Python than Skulpt is today though!

Re: Python, client side: Skulpt

#20
Maybe it's just me (Firefox 3.5.2 on WinXP), but the plus key ('+' and '=') doesn't seem to work, so I can't type 1+2 or x=1. Just tried it in Chrome, and that works fine. IE8 does too (though it's very slow).

Anyway, very neat project! How layered is it -- do you think it could approach the speed of JavaScript?

Post reply on HN