class MyArray(OrderedDict):

    def __getitem__(self, key):
        if not hasattr(key, '__iter__'):
            return MyArray({key: OrderedDict.__getitem__(self, key)})
return MyArray((k, OrderedDict.__getitem__(self, k)) for k in key)

def items(self):
    """
        called when the dictionary is printed
        """
return [(k, OrderedDict.__getitem__(self, k)) for k in self]
Пользовательский OrderedDict, который возвращает сам себя