all 15 comments

sorted by: hot top controversial new old
[–] 14 points 6 months ago (2 children)

Didn’t think I’d learn anything new in this article, but I never knew about f-string’s self-documenting expression syntax. I’ve been doing it myself like a chump!

  • source
  • hideshow 2 child comments
  • [–] 8 points 6 months ago (2 children)

    I worked in python when f-strings were pretty new. Didn't realise why you would use anything else. It just reads better.

  • source
  • hideshow 2 child comments
  • [–] 4 points 6 months ago (1 child)

    Most importantly you can't use them with translated strings, so it's not usable for user facing strings unless you don't care. This limits fstring usefulness a lot in the projects I work on.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 4 points 6 months ago

    And here I thought f-strings were something that happen when others are forced to read my code.

  • source
  • [–] 3 points 6 months ago (2 children)

    What annoyed me moving from % to format was the loss of “formatting” floats to integers with “{:d}”, now you get a ValueError

  • source
  • hideshow 2 child comments
  • [–] 3 points 6 months ago* (3 children)

    F-strings and .format() are two features I miss from Python whenever I'm writing stuff in another language. The syntax is just so minimal yet powerful

  • source
  • hideshow 3 child comments
  • [–] 1 point 6 months ago (2 children)
  • [–] 1 point 6 months ago

    Formatting strings, the running gag of the Python community.

  • source