News for hackers. Stuff that matters.
Re:Django and Postgres for the Busy Rails Developer by globular-toast on Thursday December 12, 2024 @05:04AM (#42397856)
I use htpy and it's great. There are others like htmy[0] too.

The problem with templates in general is you can write malformed HTML in them. The nice thing about htpy et al is you simply can't do that. I feel like what we really want is JSX in Python, where you can write XML-like syntax and it's converted into Python at import time.

[0] https://volfpeter.github.io/htmy/

Re:Django and Postgres for the Busy Rails Developer by davepeck on Thursday December 12, 2024 @12:14PM (#42401054)
PEP 750 started its life in part as a result of learnings from pyxl [0], which used some clever hacks to add a JSX-like syntax to Python.

In the end, my instinct is that t-strings are the better more generic feature to add to the language itself today.

That said, I'd love to see the Python ecosystem get to the point where it's relatively easy to implement transpilers and to get them integrated with key tools (colorizers, formatters, linters, type checkers, etc). After that: let a thousand JSX-likes bloom.

[0] https://github.com/gvanrossum/pyxl3

Re:Django and Postgres for the Busy Rails Developer by globular-toast on Friday December 13, 2024 @01:46PM (#42411151)
Wow, had no idea about pyxl. Thanks for the background!