from collections import OrderedDict left, right = OrderedDict(), OrderedDict() left['other'] = right right['other'] = left assert repr(left)