fix over.core.types.map.__init__
This commit is contained in:
parent
dcfd9b9f54
commit
ec98b0cde8
2 changed files with 8 additions and 10 deletions
|
@ -41,13 +41,13 @@ class map:
|
||||||
Initialize the map.
|
Initialize the map.
|
||||||
|
|
||||||
The source is a sequence of (key, value) tuples.
|
The source is a sequence of (key, value) tuples.
|
||||||
|
|
||||||
TODO fixme bug
|
|
||||||
>>> map(((1, 2, 3, 4), ('a', 'b', 'c', 'd')))
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
if 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:
|
else:
|
||||||
self.keys = []
|
self.keys = []
|
||||||
self.vals = []
|
self.vals = []
|
||||||
|
|
|
@ -41,15 +41,13 @@ class map:
|
||||||
Initialize the map.
|
Initialize the map.
|
||||||
|
|
||||||
The source is a sequence of (key, value) tuples.
|
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:
|
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:
|
else:
|
||||||
self.keys = []
|
self.keys = []
|
||||||
self.vals = []
|
self.vals = []
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue