Equivl

Compare a Python implementation against JavaScript

Two implementations in different languages can be compared by running both against the same inputs and canonicalizing their results, so that differences of language alone, such as Python returning a tuple where JavaScript returns an array, do not read as behavioral divergence.

Compare two snippets

JavaScript, TypeScript and Python run in your browser. Nothing to install, no account.

Both sides run in your browser

JavaScript and TypeScript execute in a Web Worker; Python executes in Pyodide, CPython compiled to WebAssembly. The Pyodide runtime is served with the app rather than pulled from a CDN, so a Python-against-JavaScript comparison needs no install, no server and no network once the page has loaded.

Differences that come only from the language

Without explicit rules, a port gets flagged for differences that come from the languages themselves. Each of these is a toggle:

Where ports actually diverge

The same handful of differences show up repeatedly in ports:

Questions

Can I check whether a Python function and a JavaScript function return the same thing?

Yes. Both run in your browser (JavaScript in a Web Worker and Python in Pyodide) against the same generated inputs, and their results are compared after canonicalizing differences that are purely differences of language.

How are Python and JavaScript values compared when the types do not line up?

Through explicit toggles for each mismatch: None against null, tuple against array, int against float, dictionary key order, set order, and a float tolerance. You decide which of those count as real differences for your comparison.

What usually differs between a Python function and its JavaScript port?

Integer division and modulo on negative numbers, the default sort comparing values as strings in JavaScript, and banker’s rounding in Python. They tend to agree on typical hand-picked inputs and can disagree on generated ones.

Do I need to install Python?

No. Python runs through Pyodide, which is CPython compiled to WebAssembly and served with the app rather than from a CDN, so it works in the browser and keeps working offline.

Related