The pyFlow reference.
pyFlow runs a large, growing subset of Python. Everything on this page runs today and is covered by the engine's test suite. Nothing here is aspirational.
The model is simple: your source is parsed, lowered to one typed dataflow graph, and executed on the substrate. Every operation carries a cost in picojoules.
What it runs
- ›def with positional, default (y=10), and keyword (f(y=5)) arguments
- ›Recursion and mutual recursion
- ›Return values of any type; multiple returns via tuples
- ›lambda and closures that capture their enclosing variables
- ›First-class functions: pass, return, and call them (currying)
- ›map, filter, reduce, and sorted / min / max with key=
- ›Nested def, hoisted with free-variable capture
- ›class with __init__, instance attributes, and methods
- ›obj.attr read and write; obj.method(args) dispatch
- ›Constructor defaults and keyword arguments
- ›if / elif / else, including inside loops
- ›while and for (ascending, descending, nested)
- ›break, continue, and return inside loops; for / while else
- ›with blocks, running __enter__ and __exit__
- ›Lists: index (negative too), slice, xs[i]=v, nested writes (g[0][1]=v), concat, repeat, and methods (append, extend, insert, sort, pop, reverse)
- ›Dicts: literal, access, set, membership, iteration over keys
- ›Sets and real tuples, including (1,) and (a, b) == (a, b)
- ›Comprehensions: list, dict, set, and several for clauses
- ›Generator expressions as arguments: sum(x * x for x in xs)
- ›Generators: yield and yield from
- ›Lazy and infinite generators run one step at a time (the resume-model)
- ›try / except / finally, raise, return inside try, and exceptions from called functions
- ›f-strings with format specs (f"{x:.2f}", f"{n:05d}")
- ›String iteration, indexing, and methods (upper, split, join, ...)
- ›int / float parsing, Python floored % and //, ** power, bitwise & | ^ << >>
- ›Augmented (x += 1, xs[i] += 1)
- ›Parallel / tuple (a, b = b, a) and chained (a = b = 0)
- ›Module-level globals and top-level control flow
Builtins
Around thirty builtins and methods are wired directly into the runtime, including the list, dict, string, and set operations most programs reach for:
The energy model
Each operation is priced from an analytical prior in picojoules. A multiply is not the same cost as an add, and division is far more. The receipt is the sum over the graph.
# the analytical op prior, in picojoules
Add, Sub, comparison, and/or, not 1 pJ
Mul 14 pJ
Div, Rem (modulo) 72 pJ
literal load 45 pJ # run it and read the bill
py : def poly(a, b): return (a + b) * (a - b)
call : poly(5, 3)
result : 16
energy : 16 pJ
Add 1 pJ
Sub 1 pJ
Mul 14 pJ Today the receipt is an analytical estimate. The flowg backend compiles the same graph to native code with an exact per-instruction picojoule count, which turns the estimate into a measurement. See the roadmap.
Current limits
Correctness is measured, not asserted. A corpus of ordinary Python programs runs through both CPython and pyFlow with the output compared byte for byte; 71 of 72 match exactly, and none of the rest returns a different answer. What is left is refused outright:
- ·Generators run lazily, one value at a time — including infinite ones, nested loops, conditionals, multiple yields, for-over-list, and yield from a list (a live prime sieve, for instance). Lazily driving one generator from another (yield from gen()), try across a yield, and async are on the roadmap.
- ·Mutation is value-semantic: obj.set(v) and xs.append(v) persist for a single owner, but two names bound to the same object do not co-mutate (there is no shared heap). This keeps every run byte-deterministic and energy-metered.
- ·No
globalyet. A function that rebinds a module variable is asking for a shared heap, which is the one thing the value model does not have; it is refused rather than approximated. - ·A
withblock runs__exit__on the ordinary path, but not yet when the body raises. - ·No imports or async yet.
- ·Unsupported syntax fails with a clear message rather than a wrong answer. There is no silent-wrong behavior.