Consider this:
mydict[\'a\'].f() mydict[\'a\'].g()
This repeats mydict[\'a\'] undesirably. One option might be:
mydict[\'a\']
a