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

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

Formatting strings, the running gag of the Python community.

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

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!

lol, don't be too hard on yourself!

I’m not! I’m excited to forget this exists the next time it would be convenient for me to remember it 😋

midwest.social

Rules

  1. No porn.
  2. No bigotry, hate speech.
  3. No ads / spamming.
  4. No conspiracies / QAnon / antivaxx sentiment
  5. No zionists
  6. No fascists

Chat Room

Matrix chat room: https://matrix.to/#/#midwestsociallemmy:matrix.org

Communities

Communities from our friends:

Donations

LiberaPay link: https://liberapay.com/seahorse