Python v2 logo — two snakes, red and blue python™v2
Donate

All the Flow You'd Expect

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.

More control flow tools

Python v2 is a programming language that lets you work quickly and integrate systems more effectively. »»> Learn More

The Python v2 Foundation needs your support

Python v2 is free, open source, and developed entirely by people who got tired of TabError. Help us keep the snake fed.

Donate
Python v2 0.2 “Sudbury” is out
Trailing commas, multi-line calls, cross-runtime parity tests, and a terminal raycaster.
Download v0.2

»»>Success Stories

Things people have already built with Python v2 — in a weekend, with zero GPU calls.

▶

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.

>_

The browser playground

The reference interpreter ported 1:1 to JavaScript. The console at the top of this page is the real thing — hit >_ and see.

✓

Two runtimes, one truth

64 tests lock the Python and JS runtimes together, byte for byte — including the error messages.

»»>Get Started

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.

1. Grab the runtime

git clone https://github.com/gefrus112/pythonv2
cd pythonv2

2. Run something

python3 -m pyv2 examples/hello.pyv2

3. Or just talk to it

python3 -m pyv2
>>> print(f"{'2' * 3}")
222
Installation & editor setup

Your first program

# hello.pyv2
fn greet(name):
    if name == "":
        return "Hello, stranger!"
    end
    return f"Hello, {name}!"
end

for who in ["World", ""]:
    print(greet(who))
end

»»>Why v2 beats v1

Old PythonPython v2
def foo(): + invisible whitespacefn foo(): … end
TabError: inconsistent use of tabsNo such thing. Ever.
"n=" + str(n)"n=" + n
x if ok else y (backwards)ok ? x : y
assert statementassert(cond, msg) — a normal function
Surprising nonlocal rulesClosures just work

»»>Better. By Design.

Everything you loved about Python — plus the fixes the old one never shipped.

⏎

No More Indentation Wars

Blocks open with : and close with end. Tabs, spaces — do whatever. The compiler doesn't care. Your team won't either.

ƒ

Real Closures

Assignment finds the variable that already exists, wherever it lives. Counters that count. No nonlocal incantations required.

“”

F-Strings, Solved Forever

f"Hello, {name}!" — interpolation that just works, expressions and all. String concatenation with numbers is legal too.

?

Forward Ternary

ok ? "yes" : "no" reads left to right, like your eyes do. Wild concept.

⚡

Runs In Your Browser

The same language runs in the terminal and on this very page — the playground is the real interpreter, not a screenshot.

♥

Two Implementations, One Truth

A Python reference runtime and a JavaScript twin, locked together by parity tests. Byte-identical output or the build fails.

»»> CPU Rendering. No GPU Required.

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.

– FPS CPU • 320×180 • 0 GPU calls x 6.0 y 2.0

»»>Documentation

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(...)

Print any number of values, space-separated.

print("sum:", 1 + 2)

f-strings

Interpolate any expression with braces.

f"{name} scored {score * 2}"

fn / end

Functions are values. Closures capture properly.

fn add(a, b): return a + b end

if / elif / else

Blocks end with end, not a column number.

if x > 0: print("pos") end

while / break / continue

The usual loop verbs, no surprises.

while true: break end

for … in

Iterate lists, strings, maps and ranges.

for i in range(1, 10, 2): print(i) end

lists

[1, 2, 3] with methods that spark joy.

xs.push(4) xs.sort()

maps

Bare keys, dot access, safe get.

hero = {name: "Ada"} → hero.name

ternary

Condition first, like a question should be.

status = ok ? "yes" : "no"

builtins

len, range, type, str, int, sort, join, assert, …

print(type(2), len("abc"))

string methods

upper, split, replace, trim, contains, slice, …

"a,b".split(",").join("-")

numbers

+ − * / // % **, floored mod, real division.

print(7 // 2, -7 % 3, 2 ** 10)

Full install guides & language reference: docs.html · grammar: docs/LANGUAGE.md

»»>News & Events

Oct 21, 2026

Python v2 0.2 "Sudbury" released

Trailing commas everywhere, multi-line calls, parity-tested number formatting, and a terminal raycaster example. Also: this website.

Read more →
Oct 21, 2026

Playground goes live

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 →
Coming soon

Pyv2Conf 2027 — call for talks

One track, one rule: every talk must demo something running in the CPU renderer. Stickers included.

Read more →

»»>The Community Runs On Snacks

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.

1language, zero config
2runtime twins
64passing tests
∞indentation saved

Star on GitHub Open an issue