def __init__(self, inp): if not isinstance(inp, OrderedDict): try: inp = OrderedDict(inp) except (TypeError,ValueError): raise ValueError("Input to TableList must be an OrderedDict or list of (k,v) pairs") self._dict = inp super(TableList,self).__init__(inp.values())
def __init__(self, inp): if not isinstance(inp, OrderedDict): try: inp = OrderedDict(inp) except (TypeError, ValueError): raise ValueError("Input to TableList must be an OrderedDict " "or list of (k,v) pairs") self._dict = inp super(TableList, self).__init__(inp.values())
def __init__(self, inp): if not isinstance(inp, OrderedDict): # py3 doesn't let you catch 2 types of errors. errmsg = "Input to TableList must be an OrderedDict or list of (k,v) pairs" try: inp = OrderedDict(inp) except (TypeError, ValueError): raise ValueError("Input to TableList must be an OrderedDict or list of (k,v) pairs") self._dict = inp super(TableList, self).__init__(inp.values())