mapshash tablesand skip lists python' mutableset abstract base class to aid in the creation of user-defined set classespython' collections module provides mutableset abstract base class (just as it provides the mutablemapping abstract base class discussed in section the mutableset base class provides concrete implementations for all methods described in section except for five core behaviors (adddiscardcontains len and iter that must be implemented by any concrete subclass this design is an example of what is known as the template method patternas the concrete methods of the mutableset class rely on the presumed abstract methods that will subsequently be provided by subclass for the purpose of illustrationwe examine algorithms for implementing several of the derived methods of the mutableset base class for exampleto determine if one set is proper subset of anotherwe must verify two conditionsa proper subset must have size strictly smaller than that of its supersetand each element of subset must be contained in the superset an implementation of the corresponding lt method based on this logic is given in code fragment supports syntax def lt (selfother)"""return true if this set is proper subset of other ""if len(self>len(other)return false proper subset must have strictly smaller size for in selfif not in otherreturn false not subset since element missing from other return true successall conditions are met code fragment possible implementation of the mutableset lt methodwhich tests if one set is proper subset of another as another examplewe consider the computation of the union of two sets the set adt includes two forms for computing union the syntax should produce new set that has contents equal to the union of existing sets and this operation is implemented through the special method or in python another syntaxs | is used to update existing set to become the union of itself and set thereforeall elements of that are not already contained in should be added to we note that this "in-placeoperation may be implemented more efficiently than if we were to rely on the first formusing the syntax tin which identifier is reassigned to new set instance that represents the union for conveniencepython' built-in set class supports named version of these behaviorswith union(tequivalent to tand update(tequivalent to | (yetthose named versions are not formally provided by the mutableset abstract base class