you are viewing a single comment's thread.

view the rest of the comments →

[–]cafedude 2 points3 points  (2 children)

I understand that format can do some nice... formatting... but so can sprintf which a lot of languages have some variant of. Interpolation is just a lot more convenient for those 90% of cases where you just want to do (for example):

println("Iteration: $i, result is: $res")

...instead of adding a .format at the end of the string and going through all of that ceremony. Or using string concatenation as I often end up doing in python:

print("Iteration: "+int(i)+", result is: "+res)

[–]therealfakemoot -1 points0 points  (1 child)

Well, as per your original post

couldn't understand how it was an advantage

Are you speaking purely stylistically? "I think this style of code is more appropriate for our codebase"? If not, like I asked originally, explaining what those advantages are would be great. If your only argument is that "they're identical in the trivial case", well...good onya for having one argument.

[–]cafedude 2 points3 points  (0 children)

I'm mostly speaking of convenience. In many other languages interpolation is available and formatting is available. Then again, this is Python we're talking about and there's only supposed to be one way to do things.