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