(self, key)
Allows slicing. Returns an OrderedDict if you slice.
        >>> b = OrderedDict([(7, 0), (6, 1), (5, 2), (4, 3), (3, 4), (2, 5), (1, 6)])
        >>> b[::-1]
        OrderedDict([(1, 6), (2, 5), (3, 4), (4, 3), (5, 2), (6, 1), (7, 0)])
        >>> b[2:5]
        OrderedDict([(5, 2), (4, 3), (3, 4)])
        >>> type(b[2:4])
        <class '__main__.OrderedDict'>
Allows slicing. Returns an OrderedDict if you slice.
        >>> b = OrderedDict([(7, 0), (6, 1), (5, 2), (4, 3), (3, 4), (2, 5), (1, 6)])
        >>> b[::-1]
        OrderedDict([(1, 6), (2, 5), (3, 4), (4, 3), (5, 2), (6, 1), (7, 0)])
        >>> b[2:5]
        OrderedDict([(5, 2), (4, 3), (3, 4)])
        >>> type(b[2:4])
        <class '__main__.OrderedDict'>
Allows slicing . Returns an OrderedDict if you slice . >>> b = OrderedDict ( [ ( 7 0 ) ( 6 1 ) ( 5 2 ) ( 4 3 ) ( 3 4 ) ( 2 5 ) ( 1 6 ) ] ) >>> b [ :: - 1 ] OrderedDict ( [ ( 1 6 ) ( 2 5 ) ( 3 4 ) ( 4 3 ) ( 5 2 ) ( 6 1 ) ( 7 0 ) ] ) >>> b [ 2 : 5 ] OrderedDict ( [ ( 5 2 ) ( 4 3 ) ( 3 4 ) ] ) >>> type ( b [ 2 : 4 ] ) <class __main__ . OrderedDict >
def __getitem__(self, key):
        """
        Allows slicing. Returns an OrderedDict if you slice.
        >>> b = OrderedDict([(7, 0), (6, 1), (5, 2), (4, 3), (3, 4), (2, 5), (1, 6)])
        >>> b[::-1]
        OrderedDict([(1, 6), (2, 5), (3, 4), (4, 3), (5, 2), (6, 1), (7, 0)])
        >>> b[2:5]
        OrderedDict([(5, 2), (4, 3), (3, 4)])
        >>> type(b[2:4])
        <class '__main__.OrderedDict'>
        """
        if isinstance(key, types.SliceType):
            # FIXME: does this raise the error we want?
            keys = self._sequence[key]
            # FIXME: efficiency?
            return OrderedDict([(entry, self[entry]) for entry in keys])
        else:
            return dict.__getitem__(self, key)
def __getitem__ ( self , key ) : if isinstance ( key , types . SliceType ) : # FIXME: does this raise the error we want? keys = self . _sequence [ key ] # FIXME: efficiency? return OrderedDict ( [ ( entry , self [ entry ] ) for entry in keys ] ) else : return dict . __getitem__ ( self , key )