コード例 #1
0
 def _double(self):
     # Save a reference to the old buckets.
     oldbuckets = self._buckets
     # Double the size.
     self._size *= 2
     # Create new buckets
     self._buckets = [ListMapping() for i in range(self._size)]
     # Add in all the old entries.
     for bucket in oldbuckets:
         for key, value in bucket.items():
             # Identify the new bucket.
             m = self._bucket(key)
             m[key] = value
コード例 #2
0
 def __init__(self, size=2):
     self._size = size
     self._buckets = [ListMapping() for i in range(self._size)]
     self._length = 0
コード例 #3
0
 def __init__(self):
     self._size = 100
     self._buckets = [ListMapping() for i in range(self._size)]