Brython

Brython is an in-browser runtime for Python supporting a subset of the Python 3.4 API.

In [ ]:
print(1 + 1)
In [ ]:
import this
In [ ]:
print({i: str(i) for i in range(10)})

While it mostly quacks like a Python, Brython can do some tricks with its browser module.

In [ ]:
import browser
In [ ]:
browser.document.write("Hi there!")

It even overloads <= to provide a simple native tree interface

In [ ]:
from browser.html import *

t = TABLE()
t <= TR(TH('Number')+TH('Square'))
t <= (TR(TD(i)+TD(i*i)) for i in range(10))
browser.document.body <= t