finesse.utilities.collections.OrderedSet
Overview
- class finesse.utilities.collections.OrderedSet(iterable=None)[source]
- Bases: - object- An ordered set implementation using an Dictionary to maintain the order of elements. Dictionaries in recent Python versions are all ordered now. - Parameters:
- iterableiterable, optional
- An optional iterable to initialize the ordered set with elements. 
 
- Attributes:
- _dictDict
- The internal dictionary used to maintain order and uniqueness of elements. 
 
 - Methods - add(item) - Add an element to the OrderedSet. - remove(item) - Remove an element from the OrderedSet. - difference_update(iterable) - Remove all elements from the OrderedSet that are also in the provided iterable. - update(iterable) - Add all elements from the provided iterable to the OrderedSet. - clear() - Remove all elements from the OrderedSet. - __contains__(item) - Check if an element is in the OrderedSet. - __iter__() - Return an iterator over the elements of the OrderedSet. - __len__() - Return the number of elements in the OrderedSet. - __repr__() - Return a string representation of the OrderedSet. 
Methods
| Initialize the OrderedSet with an optional iterable of elements. | |
| 
 | Add an element to the OrderedSet. | 
| 
 | Remove all elements from the OrderedSet. | 
| 
 | Create a shallow copy of this OrderedSet. | 
| 
 | Return a new OrderedSet with elements that are the difference between the two. | 
| 
 | Remove all elements from the OrderedSet that are also in the provided iterable. | 
| 
 | Check if this set is a subset of another set. | 
| 
 | Remove an element from the OrderedSet. | 
| 
 | Return a new OrderedSet with elements from the union of this set and other. | 
| 
 | Add all elements from the provided iterable to the OrderedSet. |