Comment

Comment by AF

There are advantages to both approaches. Obviously as you suggested, only using indentation makes templating more difficult than have an 'end' delimiter. But for the 90% of code that I write which isn't an HTML template, it is pretty nice to be able to not have extra ends all over the place.

But, if it is that big of a deal to you, it really is a solved issue in Python. Mako is Python in a templating language with the extra ends to make it work. Another language which is all-Python and I think pretty elegant is Breve. It uses s-expressions to do the job.

Using Mako with Django would really be very simple. I think the main reason the Django developers use Django is not so much because they don't like Python but because they are very strict about separation of display logic and business logic. Django's templates really are meant for designers, not programmers. That isn't totally appropriate in all contexts, but like I said, using Mako with Django should only be a matter of writing a few wrapper functions.

http://www.makotemplates.org/ http://breve.twisty-industries.com/

parent AF 19 years ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton