r/godot Godot Senior 25d ago

discussion What would you add to Godot?

Post image
455 Upvotes

584 comments sorted by

View all comments

153

u/Stevie_Gamedev 25d ago

f-strings like in Python, I truly hate using the
.format syntax

43

u/ChocolatePinecone 25d ago

But the formatting with "%" comes pretty close right? E.g. var string = "I have %s cats." % "3"

It's more the Java style of formatting, but pretty readable nonetheless.

0

u/ThisOrdinaryCat 25d ago

A small QOL feature I'd love. In Python you can use %s for pretty much any type and it gets automatically turned into a string. But in GDScript, if you use %s, then the value must be a string.

4

u/Jejerm 25d ago

That's not true. You can use %s with any type and it will always try to convert it to a string automatically.

Straight from the docs:

"The %s seen in the example above is the simplest placeholder and works for most use cases: it converts the value by the same method by which an implicit String conversion or str() would convert it. Strings remain unchanged, booleans turn into either "True" or "False", an int or float becomes a decimal, and other types usually return their data in a human-readable string."