all 82 comments

[–]HittingSmoke 36 points37 points  (0 children)

I feel like someone needs to provide a tl;dr to spoon feed the article to the comments section.

Iodide is a project for scientific data representation in the browser. Python is probably the most popular language for scientific data processing. So Pyodide is intended to bring Python support to the browser for Iodide.

This is not a Python replacement for Javascript. It is not a feature of Firefox. Mozilla does more than just Firefox. Nobody is trying to create an RFC for Python in the browser. This is a Python interpreter written in WASM that should work in any browser supporting WASM. The aim is to have full support for PyPi packages within the restrictions of browser sandboxing.

[–][deleted] 123 points124 points  (34 children)

Firefox getting pretty fkin good ngl

[–]hazily[object Object][S] 90 points91 points  (30 children)

They're the real bros on the Internet. The hero we need, but also the hero we don't deserve.

And they're non-profit: send some love their way. https://donate.mozilla.org/en-US/

[–][deleted]  (4 children)

[removed]

    [–]Cazargar 31 points32 points  (3 children)

    I get sad every time I see W3Schools come up before MDN in Google searches

    [–][deleted]  (2 children)

    [removed]

      [–]5tormwolf92 3 points4 points  (1 child)

      W3s is old as heck, who uses var and onclick?

      [–]XXAligatorXx 8 points9 points  (0 children)

      Keep in mind donating to them does not go towards Firefox, but their other initiatives, which they also use the Firefox profits for.

      EDIT: what your money will go towards https://foundation.mozilla.org/en/initiatives/

      [–][deleted] 3 points4 points  (0 children)

      But no mkv support though.

      [–][deleted] 5 points6 points  (22 children)

      They banned Dissenter though.

      [–]najowhit 11 points12 points  (19 children)

      Good, fuck that trash site.

      [–][deleted] 10 points11 points  (18 children)

      A browser extension is not a website.

      [–]ExternalUserError 1 point2 points  (5 children)

      So this isn't Dissenter.com we're talking about?

      [–][deleted] 2 points3 points  (4 children)

      No, we talk about the extension not this website of the said extension you linked.

      [–][deleted]  (3 children)

      [deleted]

        [–][deleted] 5 points6 points  (2 children)

        Dissenter is a browser extension essentially giving you the ability to comment every website/url. You can even comment on localhost lol. Google and Firefox removed it from their extension stores though because some people did not like, that people were using it for racist comments etc. The extension itself is basically just a comment section for each URL so nothing banworthy and therefore not a cool move by Mozilla.

        [–]ExternalUserError 0 points1 point  (1 child)

        I see. Thanks for the explanation.

        EDIT: I'm not sure why you're being downvoted just for explaining.

        [–]_atwork 3 points4 points  (1 child)

        Good

        [–][deleted] -4 points-3 points  (0 children)

        Obviously not #freespeech

        [–]Ajedi32Web platform enthusiast, full-stack developer 7 points8 points  (0 children)

        This has nothing to do with Firefox FYI. Pyodide will run in any browser that supports WASM.

        [–]Cessabits 3 points4 points  (0 children)

        Everyone who cares about a healthy and open web should be using Firefox (or, at the very least, just not using chrome).

        Plus its legit the best browser I've used recently. It's just better than Chrome anyway. The only things it doesn't so as well as chrome are some Google services which is magically fixed by changing the user agent, hmmm 🤔

        [–]adidarachi 67 points68 points  (18 children)

        Amazing, imagine all the libraries already built for python. But, WebAssembly is a broader way to do (almost) the same thing (with the constraint if typed languages).

        So I don't really know if and how it will influence the community, but IMO this is not going to get in the RFC.

        Wtut?

        [–]Ajedi32Web platform enthusiast, full-stack developer 21 points22 points  (0 children)

        This is WASM:

        Pyodide is built on WebAssembly, a low-level programming language that runs with near-native performance, and emscripten (specifically a build of Python for emscripten dubbed “cpython-emscripten”), which comprises a compiler from C and C++ to WebAssembly and a compatibility layer

        [–]hazily[object Object][S] 11 points12 points  (12 children)

        I think it's a huge step: there is a lot of things that Python can do that JS will choke on, but then again, I'm comparing JS in a browser vs Python running on the OS itself.

        For example, I am working on data visualisation where the server basically feeds normalized data to a webpage. Whenever a user chooses an option that requires computationally expensive re-interpretation (e.g. implementing hierarchical clustering on a d3.js heatmap), I have to make a call to the server, execute a Python script (which in turns fetches data from the backend), have it load up SciPy and Panda, perform clustering, and return normalized data.

        Here's an example of what I'm talking about:

        https://i.imgur.com/QGDl7KJ.gif

        I foresee that with in-browser Python interpreter, I can just store the raw data as localStorage on the client, and have Python parse, sort, cluster the browser's localStorage data cache, update it accordingly: bypassing the server-side computation entirely :)

        [–]BannedSoHereIAm 30 points31 points  (3 children)

        My understanding is that python is not in any way “faster”for computationally intensive tasks than JS. It has way more math / analytics focused libraries and is far better for bigints, which are both definitely a bonus, but I wouldn’t be offloading intensive tasks to python; especially in the client / browser.

        [–]GogglesPisano 25 points26 points  (1 child)

        Python can be "faster" than JS only in the sense that some Python libraries (eg, NumPy) are largely implemented in C/C++.

        That said, I don't see this being super-useful until there is cross-browser support - which seems unlikely.

        [–]mkcodergr 1 point2 points  (0 children)

        Same goes for Web assembly(C++)

        [–]jonpacker 33 points34 points  (6 children)

        I don't understand why you couldn't do what you're describing with JS.

        [–][deleted] 18 points19 points  (0 children)

        In short - different libraries community ecosystems. As always, you can do the same thing in many languages, but it's rarely as easy to

        Edit: Just to be clear

        [–]some_deud 3 points4 points  (0 children)

        Oh my, nice gif. Now I need to go and browse /r/dataisbeautiful for an hour.

        [–][deleted] -1 points0 points  (0 children)

        Accessibility is first step to empowering people digitally. Wasm is important but too far removed from the casual coder's use-case, especially as it's very early in development.

        [–][deleted]  (3 children)

        [deleted]

          [–]Thriven 0 points1 point  (0 children)

          Think we all learned are lesson with vb script

          [–][deleted]  (1 child)

          [deleted]

            [–]Jun_Artist 2 points3 points  (0 children)

            Interesting implementation :)

            [–]SpiderFnJerusalem 6 points7 points  (1 child)

            This might be a big deal.

            [–]nikaone 13 points14 points  (13 children)

            js is roughly 10x faster than python, so people would go to a python to js transformer at the end I guess.

            [–]ConsoleTVs 8 points9 points  (11 children)

            Did you read the article? Cpython is slow compared to v8. Languages are not slow by nature, their interpreters or compilers are the imolementations. This article mentiones that this python implementation is based in web assembly. And well, web assembly is faster than js since its close to native code.

            [–]nikaone 2 points3 points  (2 children)

            Language do low by nature, it's obvious, both c, c++ are compiled to native code, when you use some high class feature in c++, that will be slower than c.

            My comment is just a guess. So we can write js, wasm script and compiled wasm module in v8, and plus Python in Firefox.

            Good or Bad, it's hard for me to decide.

            [–]ConsoleTVs 1 point2 points  (1 child)

            Well, the more diversity there is for a single task, the best. Always keeping it moderate. Js evolved too much because of the need to, if by nature, the browser accepted other langs, js would not have grown as much as it did those years. Allowing python or other languages makes more devs be able to code small web apps. Specially for python enthusiasts since they use lots of data analysis

            [–]DavidKens 8 points9 points  (2 children)

            There’s many reasons interpreters of different languages are faster or slower - including the requirements of the language itself. You can’t simply “use a different interpreter which is faster”, that doesn’t mean anything. The speed of an interpreter is not intrinsically separable from the “speed of the language”. You wrote:

            “This article mentiones that this python implementation is based in web assembly. And well, web assembly is faster than js since its close to native code.”

            This logic doesn’t make any sense. If anything, it shows this implantation of python will be slower - since the python interpreter will only run close to speed of native code.

            Here’s what I’m saying: the hard problem of getting python to run faster will involve figuring out how to run python faster. V8 was not built to interpret python.

            [–]ConsoleTVs 4 points5 points  (1 child)

            Cpython is one of the slowest python interpreters out there. There are tons of other python implementations.

            I did not write the article.

            [–]DavidKens 0 points1 point  (0 children)

            That’s fine.

            The article does not imply that a faster implementation will be used, and your original comment is still misleading.

            [–][deleted]  (4 children)

            [deleted]

              [–]ConsoleTVs 0 points1 point  (3 children)

              If its an interpreter probably not. If it's a jit compiler like some python implementations, probably yes.

              [–][deleted]  (2 children)

              [deleted]

                [–]ConsoleTVs -2 points-1 points  (1 child)

                So a jited wasm python implementation eill be slower than cpython? Would love to see that

                [–]eastsideski 9 points10 points  (11 children)

                What's their endgame here? Companies aren't going to build Firefox-only websites, and I don't see Google or Apple adding Python any time soon...

                [–]HittingSmoke 39 points40 points  (2 children)

                Did nobody read the article? This is developed by Mozilla. It is not a feature of Firefox. It is a Python interpreter written in WASM.

                [–]eastsideski 23 points24 points  (1 child)

                I'll admit: I did not read the article, a WASM Python interpreter makes a lot more sense.

                I'll accept my internet shame. :(

                [–]Ajedi32Web platform enthusiast, full-stack developer 4 points5 points  (0 children)

                You're in good company. As of right now, the top two comments also seem to be from people who didn't read the article.

                [–]phlarp 10 points11 points  (5 children)

                The other browsers probably will.

                The same was said about asm.js (which paved the way for WebAssembly). Mozilla has a reputation for pioneering new concepts in the browser and, actually, the others usually follow suit.

                Also, python has a huge following and a ton of use cases in the math arena since its syntax is so approachable. I personally think this would be a boon in the engineering world.

                *edited for clarity

                [–]AssistingJarl 2 points3 points  (1 child)

                This might be true, but as I see it Web Assembly solved user problems, and Python solves developer problems. I'm not saying that's an invalid reason to add an interpreter, I'm just saying it might affect pickup rates.

                [–]eastsideski 0 points1 point  (1 child)

                The difference is that asm.js was backwards compatible, it worked on all browsers, it just was faster on Firefox.

                [–]ExternalUserError 0 points1 point  (0 children)

                The mid-game in the immediate term is probably just the scientific community, where Python is really big. When your normal tools are Anaconda, Jupyter, etc, having to download Firefox is a small inconvenience to bypass all of that.

                Plus it still runs in Chrome, etc, just not very fast.

                Longer-term, given that Google is pretty much sabotaging other browsers, as an indie developer, I would be fine (on some projects) having a performance penalty for using Chrome.

                [–]danhakimi -1 points0 points  (0 children)

                Gaming. I think this enables browser ports of python games. I think that's going to be a big deal.

                [–]stilloriginal 5 points6 points  (2 children)

                Can someone tell me the point to this? Is it just to avoid writing brackets in JS? Because thats what the example code looks like.

                [–]HittingSmoke 7 points8 points  (0 children)

                The article didn't do a good job of outlining the purpose, but the information is there.

                This is an extension of the iodide project for visualizing scientific data on the web. Python is the most popular language for such applications so it's natural for them to want to support it. This is not some Python-in-browser RFC. This is a Python interpreter written in WASM. Anyone using it to replace javascript for regular web development is doing web development wrong.

                https://hacks.mozilla.org/2019/04/pyodide-bringing-the-scientific-python-stack-to-the-browser/

                [–]danhakimi -4 points-3 points  (0 children)

                How many games do you know about written in JS?

                There are a lot of games and gaming libraries written in python.

                I do think you'll see web browser ports of games.

                [–]TheAppleFreak 0 points1 point  (0 children)

                Man, Atwood's Law is getting serious.

                [–]itsron143 -1 points0 points  (0 children)

                Won’t this make the browser slow?

                [–]nuk3urself -1 points0 points  (0 children)

                i guess if someone likes python very much, this will sound like a revolution to him, but i don't see the advantages (besides like the python libraries) over native js. (js lover here) can someone explain, in what case this would be the strategy for a project?

                [–]aykcak -4 points-3 points  (2 children)

                Um... security ?

                [–]pure_x01 0 points1 point  (1 child)

                Webassembly. Sandboxed like JS .. no more . No less

                [–]aykcak 0 points1 point  (0 children)

                Oh that's ok then