Show More
@@ -3028,16 +3028,19 b' class filteredset(abstractsmartset):' | |||
|
3028 | 3028 | |
|
3029 | 3029 | def last(self): |
|
3030 | 3030 | it = None |
|
3031 |
if self. |
|
|
3032 | it = self.fastdesc | |
|
3033 | elif self._subset.isdescending: | |
|
3031 | if self.isascending(): | |
|
3034 | 3032 | it = self.fastdesc |
|
3035 | if it is None: | |
|
3036 | # slowly consume everything. This needs improvement | |
|
3037 | it = lambda: reversed(list(self)) | |
|
3038 | for x in it(): | |
|
3033 | elif self.isdescending(): | |
|
3034 | it = self.fastasc | |
|
3035 | if it is not None: | |
|
3036 | for x in it(): | |
|
3037 | return x | |
|
3038 | return None #empty case | |
|
3039 | else: | |
|
3040 | x = None | |
|
3041 | for x in self: | |
|
3042 | pass | |
|
3039 | 3043 | return x |
|
3040 | return None | |
|
3041 | 3044 | |
|
3042 | 3045 | def __repr__(self): |
|
3043 | 3046 | return '<%s %r>' % (type(self).__name__, self._subset) |
General Comments 0
You need to be logged in to leave comments.
Login now