News for hackers. Stuff that matters.
Re:Introducing PyScript (summary of PyCon keynote) by lolinder on Wednesday June 22, 2022 @10:46PM (#31844635)
To me, the groundbreaking thing about this is the idea of embedding Python in its own custom script tag instead of compiling it to WASM. Maybe other languages have done that before, but I haven't seen it.

That you have to ship the entire interpreter isn't great, but what it means for development is that there is no compilation step. You don't have to deal with the WASM toolchain directly. You write your Python code, refresh the tab, and see the results. That's a huge step up from trying to use Rust and WASM for the majority of people who aren't yet Rust developers.

Obviously it's super immature at this stage, but the future possibilities are exciting.

Re:Introducing PyScript (summary of PyCon keynote) by chrismorgan on Wednesday June 22, 2022 @11:44PM (#31844964)
Doing it inside <script type="text/python">…</script>, and having the library scan for such elements, has been a standard technique in such situations for over two decades (and for stylesheet languages, like <style type="text/less">…</style>).

Doing it inside a custom element like <py-script>…</py-script> has been done occasionally, but doesn’t work well because (a) the code is now visible in the document by default and only hidden by stylesheets, and (b) < and & now need to be escaped as &lt; and &amp;.

Re:Introducing PyScript (summary of PyCon keynote) by mr_toad on Wednesday June 22, 2022 @11:46PM (#31844977)
Great for Python developers, not so great for everyone else.

This is something I find common in the Python ecosystem. There seem to be a lot of choices made more for the benefit of the developers than the end users. Even getting a Python app with some idiosyncratic build system to run can be a challenge sometimes.

Re:Introducing PyScript (summary of PyCon keynote) by toyg on Thursday June 23, 2022 @06:23AM (#31847126)
If you have to use a build system, you're not a user.
Re:Introducing PyScript (summary of PyCon keynote) by coredog64 on Wednesday June 22, 2022 @11:47PM (#31844978)
I have a vague recollection of Microsoft and/or ActiveState enabling Perl as a browser language. For a time there was an ActiveX interface for a bunch of script languages like Perl and Tcl.
Re:Introducing PyScript (summary of PyCon keynote) by cameldrv on Wednesday June 22, 2022 @10:56PM (#31844689)
It’s a great feature. Funnily enough this was a feature of the Grail web browser which actually came out a few months before the first version of Netscape with JavaScript (livescript) support
Re:Introducing PyScript (summary of PyCon keynote) by andai on Wednesday June 22, 2022 @11:32PM (#31844910)
Damn, that's really cool. Too bad hype won out in the end...
Re:Introducing PyScript (summary of PyCon keynote) by andai on Wednesday June 22, 2022 @11:31PM (#31844900)
Other languages have done that :)

Lua in the browser: https://fengari.io/

And then you can use that to run Fennel, a Lisp that compiles to Lua https://fennel-lang.org/

I think TypeScript also has a script you can include that lets you put your TS code in a special script tag, and it gets compiled in-browser.