3 ms·
I'm not sure I understand the use case for reversing the formatting variables, but you could do this to make old-style formatting work that way: >>> 'hell
by tedmiston 10y ago
I'm not sure I understand the use case for reversing the formatting variables, but you could do this to make old-style formatting work that way:
>>> 'hello, %s %s' % tuple(reversed(['smith', 'bob']))
'hello, bob smith'
I think it's more readable if you abstract that bit into a lambda function:
>>> rev_args = lambda *args: tuple(reversed(args))
>>> 'hello, %s %s' % rev_args('smith', 'bob')
'hello, bob smith'