← Back to context

Comment by littlecranky67

11 hours ago

Key benefit for reusability and composability in React is IMHO that they don't use templates at all, but everything is a function.

Exactly. There are a few libraries to achieve a similar thing in Python:

* https://htpy.dev/

* https://pypi.org/project/fast_html/

* https://fastht.ml/ (different to above, I think)

* https://github.com/volfpeter/fasthx

Probably others. I strongly prefer this to templating, but I find it makes dyed in the wool Django people squirm.

  • There are a lot of cool things about these, one that they are less typo prone and also they are often much faster.

    The downside is I find them hard to read.

    I think the template approach isn't quite right and yet neither is the functional approach.

    At the end of the day these are a type of tree structure; I think we could conjure a new mechanism that gets the best of most/both worlds.