Thursday, December 30, 2021

JavaScript <-> Python

4 tools to convert Python to JavaScript (and back again)

A newly minted Python-to-JS transpiler, Transcrypt makes intriguing promises about the quality of the code it generates.

Jiphy — meaning “JavaScript in, Python out” — converts in both directions. Plus, code from both languages can be intermixed before being converted to either target language.

Brython implements a version of Python 3 for client-side Web programming via a JavaScript library that emulates all the keywords and most of the built-ins for Python 3. Scripts written in Python can be included directly in a Web page, and Brython supplies a high-level Python module interface (browser) for performing the work with the DOM and the browser normally done directly in JavaScript.

RapydScript promises “Pythonic JavaScript that doesn’t suck.” The project is conceptually similar to CoffeeScript: Take in code written in a flavor of Python, generate JavaScript, and leverage the best of both words. In Python’s case, it’s the cleanliness of syntax; in JavaScript’s case, it’s anonymous functions, manipulation of the DOM, and being able to use existing JavaScript libraries like jQuery or the Node.js core.

No comments: