diff --git a/core/cython_types.pyx b/core/cython_types.pyx index a0fe419..a881016 100644 --- a/core/cython_types.pyx +++ b/core/cython_types.pyx @@ -41,13 +41,13 @@ class map: Initialize the map. The source is a sequence of (key, value) tuples. - - TODO fixme bug - >>> map(((1, 2, 3, 4), ('a', 'b', 'c', 'd'))) ''' if source: - self.keys, self.vals = zip(*source) + if len(source[0]) == len(source[1]): + self.keys, self.vals = source + else: + raise ValueError('over.core.types.map initialized with two sequences of different lengths') else: self.keys = [] self.vals = [] diff --git a/core/python_types.py b/core/python_types.py index 3fdd7ed..2a4cdeb 100644 --- a/core/python_types.py +++ b/core/python_types.py @@ -41,15 +41,13 @@ class map: Initialize the map. The source is a sequence of (key, value) tuples. - - TODO fixme bug - >>> map(((1, 2, 3, 4), ('a', 'b', 'c', 'd'))) ''' - #print(repr(source)) - if source: - self.keys, self.vals = zip(*source) + if len(source[0]) == len(source[1]): + self.keys, self.vals = source + else: + raise ValueError('over.core.types.map initialized with two sequences of different lengths') else: self.keys = [] self.vals = []