##// END OF EJS Templates
smartset: preserve istopo for baseset operations...
Jun Wu -
r31066:c962bb6a default
parent child Browse files
Show More
@@ -203,6 +203,14 b' class baseset(abstractsmartset):'
203 203 [[7, 6, 4, 0, 3, 5], [7, 6], [4, 0]]
204 204 >>> [type(i).__name__ for i in [xs + ys, xs & ys, xs - ys]]
205 205 ['addset', 'baseset', 'baseset']
206
207 istopo is preserved across set operations
208 >>> xs = baseset(set(x), istopo=True)
209 >>> rs = xs & ys
210 >>> type(rs).__name__
211 'baseset'
212 >>> rs._istopo
213 True
206 214 """
207 215 def __init__(self, data=(), datarepr=None, istopo=False):
208 216 """
@@ -326,7 +334,8 b' class baseset(abstractsmartset):'
326 334 # try to use native set operations as fast paths
327 335 if (type(other) is baseset and '_set' in other.__dict__ and '_set' in
328 336 self.__dict__ and self._ascending is not None):
329 s = baseset(data=getattr(self._set, op)(other._set))
337 s = baseset(data=getattr(self._set, op)(other._set),
338 istopo=self._istopo)
330 339 s._ascending = self._ascending
331 340 else:
332 341 s = getattr(super(baseset, self), op)(other)
General Comments 0
You need to be logged in to leave comments. Login now