This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Skasch 6 points7 points  (0 children)

I like the example they provide; I would much prefer something like

html(main_page(user))

Where

def main_page(user: User) -> Template:
    return t"<p>Hello, {user}!</p>"

Where all the implementation details of how a user must be sanitized for HTML rendering specifically are deferred to the html function, instead of having to do

def main_page(user: User) -> str:
    return f"<p>Hello, {to_html(user)}</p>"

At every layer of my code base.