Skip to content
Better HN
Top
Best
Ask
Show
New
Jobs
Search
⌘K
0 points
andybak
11y ago
0 comments
Save
Share
I'd recommend:
'{} {}'.format('hello', 'world')
But yes - either way - it solves the need to do str() when concatenating.
0 comments
2 comments · 1 top-level
top
newest
oldest
andreasvc
11y ago
· 1 in thread
I never understood the need for the new style of formatting, or the advantage. Fortunately % formatting is no longer getting deprecated.
pyre
11y ago
The only downside that I've come across is when you do something like:
"%s %s" % blah
If a bug causes `blah` to be a string (rather than a tuple or a list), it will attempt to expand the string, possibly giving a confusing error.
j
/
k
navigate · click thread line to collapse