equal
deleted
inserted
replaced
254 return asclist |
254 return asclist |
255 |
255 |
256 @util.propertycache |
256 @util.propertycache |
257 def _list(self): |
257 def _list(self): |
258 # _list is only lazily constructed if we have _set |
258 # _list is only lazily constructed if we have _set |
259 assert r'_set' in self.__dict__ |
259 assert '_set' in self.__dict__ |
260 return list(self._set) |
260 return list(self._set) |
261 |
261 |
262 def __iter__(self): |
262 def __iter__(self): |
263 if self._ascending is None: |
263 if self._ascending is None: |
264 return iter(self._list) |
264 return iter(self._list) |
292 else: |
292 else: |
293 self._ascending = not self._ascending |
293 self._ascending = not self._ascending |
294 self._istopo = False |
294 self._istopo = False |
295 |
295 |
296 def __len__(self): |
296 def __len__(self): |
297 if r'_list' in self.__dict__: |
297 if '_list' in self.__dict__: |
298 return len(self._list) |
298 return len(self._list) |
299 else: |
299 else: |
300 return len(self._set) |
300 return len(self._set) |
301 |
301 |
302 def isascending(self): |
302 def isascending(self): |
345 |
345 |
346 def _fastsetop(self, other, op): |
346 def _fastsetop(self, other, op): |
347 # try to use native set operations as fast paths |
347 # try to use native set operations as fast paths |
348 if ( |
348 if ( |
349 type(other) is baseset |
349 type(other) is baseset |
350 and r'_set' in other.__dict__ |
350 and '_set' in other.__dict__ |
351 and r'_set' in self.__dict__ |
351 and '_set' in self.__dict__ |
352 and self._ascending is not None |
352 and self._ascending is not None |
353 ): |
353 ): |
354 s = baseset( |
354 s = baseset( |
355 data=getattr(self._set, op)(other._set), istopo=self._istopo |
355 data=getattr(self._set, op)(other._set), istopo=self._istopo |
356 ) |
356 ) |