I tend to use the old style ("%s" % "lel"). Just wondering, does this affect that too?
>>> class foo:
... def __init__(self, **kwargs):
... self.__dict__.update(kwargs)
...
>>> my_foo = foo(secret="bazinga")
>>>
>>> "%(foo)s" % {'foo': my_foo}
'<__main__.foo instance at 0x1101d23f8>'
>>>
>>> "%(foo.secret)s" % {'foo': my_foo}
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: 'foo.secret' >>> "%(foo)s" % {"foo": "bar"}
'bar' $ printf '%2$s %2$s %1$s\n' aaa bbb
bbb bbb aaa >>> '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'