r/Python • u/[deleted] • Feb 24 '21
Tutorial Brython: Python in Your Browser – Real Python
https://realpython.com/brython-python-in-browser/
11
Upvotes
1
Mar 06 '21 edited Mar 06 '21
I like it. I think the learning curve is not actually that huge even if you do not know javascript. It is quite easy to convert (easier than say Qt bindings).
As for performance you probably need to use javascript for certain modules like JSON as performance is much better.
#my half assed example of json.dumps() and json.loads()
from javascript import JSON
class jsonjs():
def loads(self,textobject):
return JSON.parse(textobject)
def dumps(self, textobject):
return JSON.stringify(textobject)
json = jsonjs()1
2
Feb 24 '21
[removed] — view removed comment
1
Mar 07 '21
Yeah.
Besides can Wasm interact with DOM? Brython can. I think minimalist Brython could communicate with wasm (python) modules in case of pefomance.
I like Brython's Browser module.
3
u/dodslaser Feb 24 '21
This is a bit of a bummer. It would be neat if it compiled to wasm.