2395 def filter(self, condition): |
2395 def filter(self, condition): |
2396 if self._ascending is not None: |
2396 if self._ascending is not None: |
2397 return orderedlazyset(self, condition, ascending=self._ascending) |
2397 return orderedlazyset(self, condition, ascending=self._ascending) |
2398 return lazyset(self, condition) |
2398 return lazyset(self, condition) |
2399 |
2399 |
|
2400 def ascending(self): |
|
2401 if self._ascending is None: |
|
2402 self.sort() |
|
2403 self._ascending = True |
|
2404 else: |
|
2405 if not self._ascending: |
|
2406 self.reverse() |
|
2407 |
|
2408 def descending(self): |
|
2409 if self._ascending is None: |
|
2410 self.sort(reverse=True) |
|
2411 self._ascending = False |
|
2412 else: |
|
2413 if self._ascending: |
|
2414 self.reverse() |
|
2415 |
2400 def _iterator(self): |
2416 def _iterator(self): |
2401 """Iterate over both collections without repeating elements |
2417 """Iterate over both collections without repeating elements |
2402 |
2418 |
2403 If the ascending attribute is not set, iterate over the first one and |
2419 If the ascending attribute is not set, iterate over the first one and |
2404 then over the second one checking for membership on the first one so we |
2420 then over the second one checking for membership on the first one so we |