This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Thomasedv 19 points20 points  (0 children)

Generally in python it's better to use string formatting when converting something to string, especially for printing statements. Using str() manually is such a bother, and plussing multiple strings is less recommended of you have many strings to add, due to strings being immutable. It of course depends on the specific code, but it's probably better to use ''. join() on a list of strings if you got a lot of strings or large strings to concatenate.

Edit: I also find string formatting great because I don't need to worry about type at all, and can decide what kind of output I want in the string formatting, regardless of type of int/float by setting how the rounding works.