r/Python • • Jun 23 '17

Wicked! Brython as Javascript alternative? Lovely!!!

http://www.brython.info/index.html
0 Upvotes

12 comments sorted by

1

u/cybervegan Jun 23 '17

It's cool - tried it out a while back (last year). However, it seems to have got stuck.

1

u/st_ve Jun 27 '17

Really? It seems to run weel on some browsers, isn't it?

1

u/cybervegan Jun 27 '17

What I meant was that development seems to have stopped. They have some pretty cool demos on their home page tho. I'm kind of hoping that wasm will spur this kind of thing on.

1

u/st_ve Jun 27 '17

Ah ok! Sorry if I misunderstood your words. But I've checked on the github repository and it seems to be active (last commit: 18 hours ago). I just hope it could be fully integrated in a web browser, as an alternative of Javascript!!

1

u/AndydeCleyre Jun 24 '17

I think the js precompilers rapydscript/rapydscript-ng deserve some love and attention in this field.

The Brython code from Brython's Hello world example:

from browser import document as doc
from browser import alert

def echo(*args):
    alert("Hello %s !" %doc["zone"].value)

doc["test"].bind("click", echo)

The equivalent in rapydscript-ng, using jquery:

def echo(*args):
    alert(f"Hello {$('#zone').val()}!")

$("#test").bind("click", echo)

1

u/st_ve Jun 27 '17

Interesting! Didn't know that library. But I was really impressed by the fact that Python can be run inside any instance of a web browser. Maybe I'm wrong?

1

u/runbie Jun 24 '17

You could use jquery with brython if you want. With your argumentation it seems rapydscript-ng should be chosen because of this. It is very simplistic.

Disclaimer: I work on brython and I consider rapydscript a cool project with different focus and target.

1

u/AndydeCleyre Jun 24 '17

I didn't intend to argue that using jquery was an advantage of rapydscript, sorry.

1

u/runbie Jun 24 '17

No worries :-)

I just try to highlight that this kind of comments, sometimes unintentionally, could be quite counter-productive and discourage people to try projects. Brython and rapydscript goals are quite different and both, together with skulpt, pybee, pypyjs, transcrypt,..., maybe could lead to something even cooler. I think we should provide more love and thought to our comments and the work of others but, anyway, this is internet ;-)

1

u/AndydeCleyre Jun 24 '17

Would you like to write a little here about the goals of Brython, as they contrast with RS-NG's?

1

u/runbie Jun 24 '17

Brython tries to provide a full python3 implementation to the browser, i.e. you can write directly python code to be used directly as if it was JS on the client side.

Rapydscript-ng is a not python nor JS. It tries to resemble python that translates directly to performant JS. Also, it is not a transpiler on-the-fly like brython, it is an ahead-of-time transpiler.

Brython is not fast but it is (more) python compliant and directly usable (no pre-transpilation if you do not want) than rs-ng. Depending your needs you could choose one or other (or the rest of the options).

2

u/CGFarrell Jun 23 '17

This title has too many interjections, and too much punctuation.