Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Hi. I come from a JavaScript background.

I am wondering what is the reason behind not using a similar syntax to JavaScript? Seems simpler to me.

  # Compare this:
  template = t"<p>{evil}</p>"
  safe = html(template)

  # To this:
  safe = html"<p>{evil}</p>"


The PEP originally started with a similar-to-javascript syntax but over time we decided it wasn't the right way to expose these ideas in Python. There's more detail about why this approach was rejected in the PEP: https://peps.python.org/pep-0750/#arbitrary-string-literal-p...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: