1 from __future__
import print_function
33 end += [
None, end, end]
35 if iterable
is not None:
42 return key
in self.
map
45 if key
not in self.
map:
48 curr[2] = end[1] = self.
map[key] = [key, curr, end]
52 key, prev, next = self.
map.
pop(key)
59 while curr
is not end:
66 while curr
is not end:
70 def pop(self, last=True):
72 raise KeyError(
'set is empty')
73 key = self.
end[1][0]
if last
else self.
end[2][0]
79 return '%s()' % (self.__class__.__name__,)
80 return '%s(%r)' % (self.__class__.__name__, list(self))
83 if isinstance(other, OrderedSet):
84 return len(self) == len(other)
and list(self) == list(other)
85 return set(self) == set(other)
88 if __name__ ==
'__main__':