Skip to content

Comment on Python string literals are kinda funnyparent

Comments

Indeed, and I get that one can ignore those features (I do), but finding them in existing code or having the AI coding agent use them diminishes the "easy for beginners" aspect.

How is, say, `age = 5; print(f"Age: {age} years old")` not easy for beginners? IMO it's as easy as it gets: you want the value of `age` printed {HERE}, so you just put it where you want it, surrounded by curly brackets.

Are f-strings not easy for beginners? What would you prefer instead?

I'd prefer one way of doing things. I do understand that the improvements to string literals are improvements, but it means there are multiple things to learn.

Your one way is f-strings, that's it. Disregard the others unless you have an extremely good reason not to.

You and Claude agree. ;-) And me too, I must admit.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.