We can program, right now, web pages using Python! 

Imagine my surprise.  While studying the python sources in 
live-py-plugin/plugin/PySrc/code_tracer.py I ran across JS code!

def web_main():
    display()
    document.getElementById('source').addEventListener('input', display)

Huh? Here is the top-level code:

if __name__ == '__main__':
    main()
elif IS_PYODIDE:
    web_main()

Googling pyodide yields this page 
<https://github.com/iodide-project/pyodide>.  From the readme file at the 
bottom:

The Python scientific stack, compiled to WebAssembly. It provides 
transparent conversion of objects between Javascript and Python. When 
inside a browser, this means Python has full access to the Web APIs.


OMG: WebAssembly <https://webassembly.org/>is a web standard 
<https://www.w3.org/TR/wasm-core-1/> and is supported in all major 
browsers!! From the MDN page 
<https://developer.mozilla.org/en-US/docs/WebAssembly>:


QQQ

WebAssembly is a new type of code that can be run in modern web browsers—it 
is a low-level assembly-like language with a compact binary format that 
runs with near-native performance and provides languages such as C/C++ with 
a compilation target so that they can run on the web. It is also designed 
to run alongside JavaScript, allowing both to work together.


WebAssembly has huge implications for the web platform—it provides a way to 
run code written in multiple languages on the web at near native speed, 
with client apps running on the web that previously couldn’t have done so.

QQQ


>From the wikipedia page <https://en.wikipedia.org/wiki/WebAssembly>:


QQQ
WebAssembly is a web standard <https://en.wikipedia.org/wiki/Web_standards> 
that defines a binary format and a corresponding assembly 
<https://en.wikipedia.org/wiki/Assembly_language>-like text format for 
executable code <https://en.wikipedia.org/wiki/Computer_code> in Web 
<https://en.wikipedia.org/wiki/World_Wide_Web> pages. It is meant to enable 
executing code nearly as quickly as running native machine code 
<https://en.wikipedia.org/wiki/Machine_code>. It was envisioned to 
complement JavaScript <https://en.wikipedia.org/wiki/JavaScript> to speed 
up performance-critical parts of web applications and later on to enable web 
development <https://en.wikipedia.org/wiki/Web_development> in languages 
other than JavaScript. WebAssembly does not attempt to replace JavaScript, 
but to complement it. It is developed at the World Wide Web Consortium 
<https://en.wikipedia.org/wiki/World_Wide_Web_Consortium> (W3C) with 
engineers from Mozilla <https://en.wikipedia.org/wiki/Mozilla>, Microsoft 
<https://en.wikipedia.org/wiki/Microsoft>, Google 
<https://en.wikipedia.org/wiki/Google>, and Apple 
<https://en.wikipedia.org/wiki/Apple_Inc.>. 
QQQ


This looks like the way around the lack of browser support for python.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to