Skip to content

Comment on A possible future of Python in the browser

Comments

I have a Node background so I might be biased but... Why would you want python in the browser?

Like, I get the appeal of more languages beyond JavaScript for the frontend, but I'd have guessed this would mostly be attractive to people who like significantly different languages to js, like maybe something compiled and strongly typed.

Python and Javascript seem to be in the same ballpark of "interpreted scripty language grown larger". I don't think moving to python would give me a different enough language to warrant the cost of switching.

I personally find Python way easier to use and understand, and I have more experience with it. I wouldn't be "switching," I would just be writing in Python. I think having more language options would further democratize web development.

I think the other points of view on this thread where people point out how ridiculous it would be to force you to use one specific language on the desktop or even on mobile are thought-provoking.

If I can make iPhone apps with .NET [1] why not client-side browser code with Python?

[1] https://learn.microsoft.com/en-us/dotnet/maui/what-is-maui?v...

Maybe doing scientific stuff in-browser that you would normally need a Python backend (with numpy etc) to do. I don't see it being used for driving UIs.

Getting python running in the browser and getting to the point the packages people care about (torch, numpy etc) would work in the browser seems a huge leap.

You can't even package up a python application to work on an arbitrary machine with those libraries without a world of hurt and some quite laughable hacks, most distributed python software is started from a .bat file that installs a local copy of python not an .exe, the ones that are a single .exe (PyInstaller) unzip themselves into a temp folder every time they are run.

With how poor Python is at even distributing software written in it's home desktop environment to another machine it's going to be a large leap to get all that to work on another machine without in another environment. (Environment as in desktop/browser not venv wrapper)

Python seems so limited in where it can go by the ideological choice that it's installed into the base of the operating system rather than treating it's libraries as relative to it's scripts location. Entire ecosystem is built within wrappers just for this ideology.

Says a lot imho when it's easier to distribute a Javascript application to people than a Python one when JS was never intended to run outside a browser.

Hasn't Pyodide already made this leap? I know the pain of dealing with the Python runtime and packaging across machines, but in this case, the browser is providing a pretty uniform environment.

Unlike JS, Python actually has standard library. Sync by default, optional async, rich community that is (arguably) has better quality on average, scientific and AI tooling, language itself is (arguably) nicer too with all the decorator, contextmanager stuff. Built in typing. That’s just off the top of my head.

I prefer Python over Javascript. But I also prefer build-less over compilations steps. So that's Python on the server, Javascript on the browser. Of course there's Brython, but I don't think it competes performance-wise.

It's for people with taste in scripting languages.

I hear what your are saying, but there is some advantage to having the same language in multiple places in the stack. One of the advantages of JavaScript is that it can be used both on the front-end and the server. Some people hate that and insist that "real" programmers use a "real" server language but that is not a reasoned take. There are pragmatic reasons to want the same language across the stack.

And so it sometimes goes the other way. Java was used through a transpiler for the front-end for some of the classic Google apps (I don't know if that is still the case). So it makes some sense, for a Python heavy team, to consider the same approach. And with the growing support of WASM it is probably even easier than it was when it required transpilation to JavaScript. And since a lot of ML work is in Python there is undoubtedly growing interest.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.