I've inherited some Python code that constructs a string from the string arguments passed into __init__:
self.full_tag = prefix + number + point + suffix
Maybe I'm just over-thinking it but is this the best way to concatenate the arguments? I know it's possible to do something like:
self.full_tag = "".join([prefix, number, point, suffix])
Or just using string format function:
self.full_tag = '{}{}{}{}'.format(prefix, number, point, suffix)
What is the Python way of doing this?
+is likely to be the least efficient (though you shouldtimeitto be sure ;-). If it's not a bottleneck though, I'm not sure that any of the ways really matter too much. They're all fairly clear in what you're trying to accomplish with that line of code...