Show More
@@ -3077,14 +3077,9 b' class filteredset(abstractsmartset):' | |||||
3077 | """ |
|
3077 | """ | |
3078 | self._subset = subset |
|
3078 | self._subset = subset | |
3079 | self._condition = condition |
|
3079 | self._condition = condition | |
3080 | self._cache = {} |
|
|||
3081 |
|
3080 | |||
3082 | def __contains__(self, x): |
|
3081 | def __contains__(self, x): | |
3083 | c = self._cache |
|
3082 | return x in self._subset and self._condition(x) | |
3084 | if x not in c: |
|
|||
3085 | v = c[x] = x in self._subset and self._condition(x) |
|
|||
3086 | return v |
|
|||
3087 | return c[x] |
|
|||
3088 |
|
3083 | |||
3089 | def __iter__(self): |
|
3084 | def __iter__(self): | |
3090 | return self._iterfilter(self._subset) |
|
3085 | return self._iterfilter(self._subset) |
General Comments 0
You need to be logged in to leave comments.
Login now