Please clarify this behavior in python3:
>>> ''.join('<%s>%s</%s>' % (tag, content, tag) for tag, content in {'b': 'bold'}.items())
'<b>bold</b>'
>>> '<%s>%s</%s>' % (tag, content, tag) for tag, content in {'b': 'bold'}.items()
File "<stdin>", line 1
'<%s>%s</%s>' % (tag, content, tag) for tag, content in {'b': 'bold'}.items()
^
SyntaxError: invalid syntax
From https://docs.python.org/3/library/stdtypes.html#str.join, its argument is supposed to be an iterable. If you look closely, the same argument provided to join in this example is giving an syntax error when inspected by itself.
I don't understand how this is supposed to work as an argument but can't be inspected as a value.
Thanks for your attention.