Show More
@@ -2409,6 +2409,19 b' class _addset(object):' | |||
|
2409 | 2409 | def set(self): |
|
2410 | 2410 | return self |
|
2411 | 2411 | |
|
2412 | def sort(self, reverse=False): | |
|
2413 | """Sort the added set | |
|
2414 | ||
|
2415 | For this we use the cached list with all the generated values and if we | |
|
2416 | know they are ascending or descending we can sort them in a smart way. | |
|
2417 | """ | |
|
2418 | if self._ascending is None: | |
|
2419 | self._list.sort(reverse=reverse) | |
|
2420 | self._ascending = not reverse | |
|
2421 | else: | |
|
2422 | if bool(self._ascending) == bool(reverse): | |
|
2423 | self.reverse() | |
|
2424 | ||
|
2412 | 2425 | def reverse(self): |
|
2413 | 2426 | self._list.reverse() |
|
2414 | 2427 | if self._ascending is not None: |
General Comments 0
You need to be logged in to leave comments.
Login now