/suba

Suba is a very fast template engine for Python 3k.

Primary LanguagePython

Suba
----
Author: Jesse Dailey <jesse.dailey@gmail.com>

Suba (suhb-uh) is a fast template engine.

Inspired by python's Mod (%) operator's string substitution.

>>> template(text="This is a test of %(who)s.", who="Suba")
'This is a test of Suba.'

Unlike the Mod operator, you can include ANY valid python as the substitution expression, not just key names.

>>> template(text="These are numbers: %( " ".join((x+x for x in range(1,10))) )s")
'These are numbers: 2 4 6 8 10 12 14 16 18'

See the extensive doctests in suba.py, and the test/ folder.

For a speed comparison, look in the benchmark/ folder.