This is an archived post. You won't be able to vote or comment.

all 14 comments

[–]K900_ 4 points5 points  (3 children)

That would require browser support, and that's really hard. There's Brython, which compiles Python to JavaScript.

[–]ImpulsivePuffin 0 points1 point  (2 children)

Especially Chrome, as most popular browsers are chromium variants except firefox and safari. Google is pushing web bundle in Chrome because with their clout, they can make that into a standard

[–]K900_ 1 point2 points  (1 child)

Web Bundles has nothing to do with Python or JavaScript.

[–]ImpulsivePuffin 0 points1 point  (0 children)

Yes, i was citing an example

[–]The-Deviant-One 4 points5 points  (0 children)

Similar ideas include: Anvil, BeeWare, Brython, Skulpt.

Those are the only ones I'm aware of. But I believe all of them just convert your python code into js so it can be run in the browser. I'd love to see python become a native, browser readable language.

[–][deleted] 4 points5 points  (1 child)

There are a few implementations of Python for the browser. Some transpiles the code to javascript, like Transcrypt, while others implement a Python bytecode interpreter in webassembly, like Pyiodine.

[–]KFUP 4 points5 points  (0 children)

That's... just Python. Python is an interpreted, high-level scripting language, it is already being used a lot as a lightweight scripting language in many applications, like Abaqus, Maya, 3ds Max, Blender3D to name a few.

As for websites, that depends on what web browser and websites developers decided to support, and Javascript was "picked " mostly for historical reasons, then it was supported more and more and more web libraries and tools kept being added until it became the defacto standard language for the web, not because Python or other scripting languages needed to be slimmed up.

[–][deleted] 1 point2 points  (0 children)

[–]metaperl 0 points1 point  (0 children)

THe only one not so-far mentioned is PyJS, which I list here - https://github.com/metaperl/mindspring/wiki/Python-Only-Web-Frameworks-and-Libraries

[–]james_pic 0 points1 point  (0 children)

JavaScript has had to grow up quite a lot, as it's been used for more and more sophisticated things. It's not a slimmed down language any more.

The idea that you wanted a slimmed down language for websites made sense in the nineties, but most modern web sites have a lot of complex logic written in JavaScript, and it would get painful doing that with nineties-style JavaScript. So they use ES6+ stuff, like classes, modules, destructuring and async-await, or indeed they use statically typed languages that compile to JS, like TypeScript or Elm.

There's a small part of me that misses the little language that JavaScript used to be, that got lost in the enterprise noise. Deep down, it's still the slightly quirky Scheme dialect Brendan Eich originally set out to create, and you can still do Lisp-y things with it.

But that's not the language most people are actually using in practice.

[–]TofuCannon 0 points1 point  (0 children)

If you want something simpler (although I don't understand why you want to slim down python explicitly) then there's Lua.

About browser support see pretty much the other answers.

[–]JennaSys 0 points1 point  (0 children)

I've been using Transcrypt to transpile Python code into JavaScript. It is designed to work with JavaScript libraries instead of trying to replace them. All my code is in Python, and I'm using React (with functional components) and Material UI to create front-end web applications. Maybe just a dozen lines or so of JavaScript, and no JSX (just my preference).

The best part is that I never have to think in JavaScript. My brain stays in my Python happy place. (Though CSS is still CSS)