Show More
@@ -2630,8 +2630,8 b' class _generatorset(object):' | |||||
2630 | if x in self._cache: |
|
2630 | if x in self._cache: | |
2631 | return self._cache[x] |
|
2631 | return self._cache[x] | |
2632 |
|
2632 | |||
2633 | # Use __iter__ which caches values and stores them into self._genlist |
|
2633 | # Use new values only, as existing values would be cached. | |
2634 | for l in self: |
|
2634 | for l in self._consumegen(): | |
2635 | if l == x: |
|
2635 | if l == x: | |
2636 | return True |
|
2636 | return True | |
2637 |
|
2637 | |||
@@ -2645,17 +2645,18 b' class _generatorset(object):' | |||||
2645 | # started over the generatorset. |
|
2645 | # started over the generatorset. | |
2646 | for l in self._genlist: |
|
2646 | for l in self._genlist: | |
2647 | yield l |
|
2647 | yield l | |
2648 | else: |
|
2648 | ||
2649 | # Starting iteration over the generatorset. |
|
2649 | for item in self._consumegen(): | |
2650 |
|
|
2650 | yield item | |
|
2651 | ||||
|
2652 | def _consumegen(self): | |||
|
2653 | self._iterated = True | |||
2651 |
|
2654 | |||
2652 | for item in self._gen: |
|
2655 | for item in self._gen: | |
2653 | self._cache[item] = True |
|
2656 | self._cache[item] = True | |
2654 | self._genlist.append(item) |
|
2657 | self._genlist.append(item) | |
2655 | yield item |
|
2658 | yield item | |
2656 |
|
2659 | |||
2657 | # Iteration over the generator has finished. Whole value list should be |
|
|||
2658 | # cached in self._genlist |
|
|||
2659 | self._finished = True |
|
2660 | self._finished = True | |
2660 |
|
2661 | |||
2661 | def set(self): |
|
2662 | def set(self): | |
@@ -2680,7 +2681,8 b' class _ascgeneratorset(_generatorset):' | |||||
2680 | if x in self._cache: |
|
2681 | if x in self._cache: | |
2681 | return self._cache[x] |
|
2682 | return self._cache[x] | |
2682 |
|
2683 | |||
2683 | for l in self: |
|
2684 | # Use new values only, as existing values would be cached. | |
|
2685 | for l in self._consumegen(): | |||
2684 | if l == x: |
|
2686 | if l == x: | |
2685 | return True |
|
2687 | return True | |
2686 | if l > x: |
|
2688 | if l > x: | |
@@ -2702,7 +2704,8 b' class _descgeneratorset(_generatorset):' | |||||
2702 | if x in self._cache: |
|
2704 | if x in self._cache: | |
2703 | return self._cache[x] |
|
2705 | return self._cache[x] | |
2704 |
|
2706 | |||
2705 | for l in self: |
|
2707 | # Use new values only, as existing values would be cached. | |
|
2708 | for l in self._consumegen(): | |||
2706 | if l == x: |
|
2709 | if l == x: | |
2707 | return True |
|
2710 | return True | |
2708 | if l < x: |
|
2711 | if l < x: |
General Comments 0
You need to be logged in to leave comments.
Login now