The CPU raycaster
A Wolfenstein-style renderer that computes all 57,600 pixels per frame on the CPU. It runs right on this page — scroll down to play it.
Python v2 knows the usual control flow statements that other
languages speak — if, for, while and
range — with some of its own twists, of course.
Python v2 is a programming language that lets you work quickly and integrate systems more effectively. »»> Learn More
Python v2 is free, open source, and developed entirely by people who
got tired of TabError. Help us keep the snake fed.
Things people have already built with Python v2 — in a weekend, with zero GPU calls.
A Wolfenstein-style renderer that computes all 57,600 pixels per frame on the CPU. It runs right on this page — scroll down to play it.
The reference interpreter ported 1:1 to JavaScript. The console at the top of this page is the real thing — hit >_ and see.
64 tests lock the Python and JS runtimes together, byte for byte — including the error messages.
Python v2 is free and open source. It runs anywhere Python 3 runs — no install step, no dependencies. Full setup guides for VS Code, dev containers, desktop and any editor are on the Downloads page and in the documentation — then learn the language with the tutorial.
git clone https://github.com/gefrus112/pythonv2
cd pythonv2
python3 -m pyv2 examples/hello.pyv2
python3 -m pyv2
>>> print(f"{'2' * 3}")
222
Installation & editor setup
# hello.pyv2
fn greet(name):
if name == "":
return "Hello, stranger!"
end
return f"Hello, {name}!"
end
for who in ["World", ""]:
print(greet(who))
end
| Old Python | Python v2 |
|---|---|
def foo(): + invisible whitespace | fn foo(): … end |
| TabError: inconsistent use of tabs | No such thing. Ever. |
"n=" + str(n) | "n=" + n |
x if ok else y (backwards) | ok ? x : y |
assert statement | assert(cond, msg) — a normal function |
Surprising nonlocal rules | Closures just work |
Everything you loved about Python — plus the fixes the old one never shipped.
Blocks open with : and close with end.
Tabs, spaces — do whatever. The compiler doesn't care. Your team won't either.
Assignment finds the variable that already exists, wherever it lives.
Counters that count. No nonlocal incantations required.
f"Hello, {name}!" — interpolation that just works,
expressions and all. String concatenation with numbers is legal too.
ok ? "yes" : "no" reads left to right, like your eyes do.
Wild concept.
The same language runs in the terminal and on this very page — the playground is the real interpreter, not a screenshot.
A Python reference runtime and a JavaScript twin, locked together by parity tests. Byte-identical output or the build fails.
This level is drawn the hard way: a software raycaster computes every
single pixel on the CPU and writes it into a 320×180 framebuffer. No WebGL.
No shaders. 57,600 pixels per frame of pure for loops.
Learn the language step by step in the tutorial — or dig into installation in VS Code, dev containers / Codespaces, desktop and any code editor.
Print any number of values, space-separated.
print("sum:", 1 + 2)
Interpolate any expression with braces.
f"{name} scored {score * 2}"
Functions are values. Closures capture properly.
fn add(a, b): return a + b end
Blocks end with end, not a column number.
if x > 0: print("pos") end
The usual loop verbs, no surprises.
while true: break end
Iterate lists, strings, maps and ranges.
for i in range(1, 10, 2): print(i) end
[1, 2, 3] with methods that spark joy.
xs.push(4) xs.sort()
Bare keys, dot access, safe get.
hero = {name: "Ada"} → hero.name
Condition first, like a question should be.
status = ok ? "yes" : "no"
len, range, type, str,
int, sort, join, assert, …
print(type(2), len("abc"))
upper, split, replace,
trim, contains, slice, …
"a,b".split(",").join("-")
+ − * / // % **, floored mod, real division.
print(7 // 2, -7 % 3, 2 ** 10)
Full install guides & language reference: docs.html · grammar: docs/LANGUAGE.md
Trailing commas everywhere, multi-line calls, parity-tested number formatting, and a terminal raycaster example. Also: this website.
Read more →The interpreter now runs in your browser at 100% fidelity with the reference runtime. Try the console at the top of this page.
Read more →One track, one rule: every talk must demo something running in the CPU renderer. Stickers included.
Read more →Python v2 is built in the open on GitHub. Star the repo, file an
issue, send a pull request, or just argue about end vs braces.