Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library

Comment by Liquid_Fire

9 hours ago

Perhaps it's because in all but the simplest cases, you need 2 or more concatenations to achieve the same result as one single f-string?

  "literal1 " + str(expression) + " literal2"

vs

  f"literal1 {expression} literal2"

The only case that would be faster is something like: "foo" + str(expression)

0 comments

Liquid_Fire

Reply

No comments yet

Contribute on Hacker News ↗

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities