News for hackers. Stuff that matters.
Re:Be Careful with Python's New-Style String Format by tedmiston on Saturday December 31, 2016 @07:07PM (#13293925)
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'

There are no comments on this comment yet.