I want to create a custom set that will automatically convert objects into a different form for storage in the set (see Using a Python Dictionary as a key non-nested) for ba
In Python 2.6:
import collections
print collections.MutableSet.__abstractmethods__
# prints:
# frozenset(['discard', 'add', '__iter__', '__len__', '__contains__'])
subclass collections.MutableSet and override the methods in the list above.
the update method itself is very easy, given that the bare minimum above is implemented
def update(self, iterable):
for x in iterable:
self.add(x)