starlark icon indicating copy to clipboard operation
starlark copied to clipboard

Formatted string literals (PEP 498)

Open arturdryomov opened this issue 4 years ago • 13 comments

PEP 498 introduced formatted string literals which make this possible:

>>> name = "Star-Lord"
>>> f"Starlark, say hi to {name}"
'Starlark, say hi to Star-Lord'

It would be nice to have it as an alternative to the regular string formatting, especially since modern languages like Kotlin and Swift make this formatting convenient and less error-prone.

val name = "Star-Lord"
val greeting = "Starlark, say hi to $name"
let name = "Star-Lord"
let greeting = "Starlark, say hi to \(name)"

However, I can completely understand that sometimes a language should be simple. So this is just an idea.

arturdryomov avatar Dec 04 '19 05:12 arturdryomov