3 ms·
Python already has built-in data structure literals that allow you to express lispy DSLs: html(['ul', {'class': 'foo'}, *(['li', item] for item in items)])
by MathMonkeyMan 1y ago
Python already has built-in data structure literals that allow you to express lispy DSLs:
html(['ul', {'class': 'foo'}, *(['li', item] for item in items)])
I guess template strings do make it more concise. Kind of like Racket's "#lang at-exp racket".
The benefit of lisp-like representation is you have the entire structure of the data, not just a sequence of already-serialized and not-yet-serialized pieces.