For a practical example of this technique used in JS take a look at libraries like htm and lit-html: https://github.com/developit/htm
It required a janky workaround for the absence of this PEP: https://pypi.org/project/tagged/
I used these to investigate ideas about component-driven development: https://viewdom.readthedocs.io/en/latest/