Live data from Hacker News

PyPy.js: Python in the web browser

pypyjs.org

71–80 of 129 posts

Re: PyPy.js: Python in the web browser

#71
post #57
post #47

Earlier quoted context omitted.

But then you have to code in... Tcl...

Then you GET to code in Tcl !

>Then you GET to code in Tcl ! I don't care about Tcl but your enthusiasm is golden. Sort of why I write silly stuff in bash or in an esoteric manner; "Why" "Cause we can!!"

Re: PyPy.js: Python in the web browser

#72
post #52

The speed is surprisingly reasonable. Testing with a simple loop, I get about 1.3-1.4 million loops per second in python3, 2 million loops per second in python2, 14.5 million loops in pypy, and 0.61 million loops in the browser. My code basically calls int(time.time()) until its value changes, doing i+=1 for every time it did not change (n=10 for every platform (python2/3/pypy/browser)). My browser is Firefox 61, ful…

I wonder if the time.time is the slow part there? Maybe worth doing a busy look for say 5 million iterations, timing that then doing the calculation for loops per second.

Re: PyPy.js: Python in the web browser

#73
post #69
post #67

Earlier quoted context omitted.

> If you're so afraid that this is dangerous, why do you post malicious code? That's not malicious code... it removes files from a sandbox... you can refresh the page and see for yourself. > And if you're so clever to post that code There's no need to be rude... there's an honest question and lack of understanding in my post - educate me, don't talk down to me. > why don't you try similar code to see if it really has…

Well why doesn't this apply to JS? The python interpreter is running in the JS sandbox

I suppose that was the explanation I was looking for.

Re: PyPy.js: Python in the web browser

#74
post #57
post #47

Earlier quoted context omitted.

But then you have to code in... Tcl...

Then you GET to code in Tcl !

Given how terrible GUI development in javascript is for the developer, this would be a net improvement.

However the language I yearn for in browsers is Lua.

Re: PyPy.js: Python in the web browser

#76
post #75

File " ", line 2 return f'{fname} {surname} is {age}.' ^ SyntaxError: invalid syntax So this is a subset of Python or something like that?

I believe this feature was introduced in Python 3.6. This implementation may be 3.6 Edit: Just checked the site and see it uses PyPy which states -- on their site -- the python version is 3.5.3

Re: PyPy.js: Python in the web browser

#78
post #52

The speed is surprisingly reasonable. Testing with a simple loop, I get about 1.3-1.4 million loops per second in python3, 2 million loops per second in python2, 14.5 million loops in pypy, and 0.61 million loops in the browser. My code basically calls int(time.time()) until its value changes, doing i+=1 for every time it did not change (n=10 for every platform (python2/3/pypy/browser)). My browser is Firefox 61, ful…

Though trying to add the numbers for 1 to a million in a loop javascript was about 10 - 20 times faster when I tried it.

Re: PyPy.js: Python in the web browser

#80

I'd love there to be a client-side webapp development system using Python with feature and output parity to JavaScript. If it was a product, I would buy it.

While not exactly that, https://anvil.works/ is kind of heading that way (https://news.ycombinator.com/item?id=15584124)
Post reply on HN