##// END OF EJS Templates
baseset: prepare lazy ordering in __iter__...
Pierre-Yves David -
r22827:c1107cb2 default
parent child Browse files
Show More
@@ -2331,6 +2331,7 class baseset(abstractsmartset):
2331 data = list(data)
2331 data = list(data)
2332 self._list = data
2332 self._list = data
2333 self._set = None
2333 self._set = None
2334 self._ascending = None
2334
2335
2335 @util.propertycache
2336 @util.propertycache
2336 def _asclist(self):
2337 def _asclist(self):
@@ -2338,6 +2339,14 class baseset(abstractsmartset):
2338 asclist.sort()
2339 asclist.sort()
2339 return asclist
2340 return asclist
2340
2341
2342 def __iter__(self):
2343 if self._ascending is None:
2344 return iter(self._list)
2345 elif self._ascending:
2346 return iter(self._asclist)
2347 else:
2348 return reversed(self._asclist)
2349
2341 def fastasc(self):
2350 def fastasc(self):
2342 return iter(self._asclist)
2351 return iter(self._asclist)
2343
2352
@@ -2368,9 +2377,6 class baseset(abstractsmartset):
2368 def reverse(self):
2377 def reverse(self):
2369 self._list.reverse()
2378 self._list.reverse()
2370
2379
2371 def __iter__(self):
2372 return iter(self._list)
2373
2374 def __len__(self):
2380 def __len__(self):
2375 return len(self._list)
2381 return len(self._list)
2376
2382
General Comments 0
You need to be logged in to leave comments. Login now