Show More
@@ -2348,6 +2348,7 b' class generatorset(object):' | |||||
2348 | self._cache = {} |
|
2348 | self._cache = {} | |
2349 | self._genlist = baseset([]) |
|
2349 | self._genlist = baseset([]) | |
2350 | self._iterated = False |
|
2350 | self._iterated = False | |
|
2351 | self._finished = False | |||
2351 |
|
2352 | |||
2352 | def __contains__(self, x): |
|
2353 | def __contains__(self, x): | |
2353 | if x in self._cache: |
|
2354 | if x in self._cache: | |
@@ -2357,6 +2358,7 b' class generatorset(object):' | |||||
2357 | if l == x: |
|
2358 | if l == x: | |
2358 | return True |
|
2359 | return True | |
2359 |
|
2360 | |||
|
2361 | self._finished = True | |||
2360 | self._cache[x] = False |
|
2362 | self._cache[x] = False | |
2361 | return False |
|
2363 | return False | |
2362 |
|
2364 | |||
@@ -2372,9 +2374,18 b' class generatorset(object):' | |||||
2372 | self._genlist.append(item) |
|
2374 | self._genlist.append(item) | |
2373 | yield item |
|
2375 | yield item | |
2374 |
|
2376 | |||
|
2377 | self._finished = True | |||
|
2378 | ||||
2375 | def set(self): |
|
2379 | def set(self): | |
2376 | return self |
|
2380 | return self | |
2377 |
|
2381 | |||
|
2382 | def sort(self, reverse=False): | |||
|
2383 | # Basic implementation to be changed in future patches | |||
|
2384 | if not self._finished: | |||
|
2385 | for i in self: | |||
|
2386 | continue | |||
|
2387 | self._genlist.sort(reverse=reverse) | |||
|
2388 | ||||
2378 | class ascgeneratorset(generatorset): |
|
2389 | class ascgeneratorset(generatorset): | |
2379 | """ Same structure as generatorset but stops iterating after it goes past |
|
2390 | """ Same structure as generatorset but stops iterating after it goes past | |
2380 | the value when asked for membership and the element is not contained |
|
2391 | the value when asked for membership and the element is not contained |
General Comments 0
You need to be logged in to leave comments.
Login now