On 2007-07-29, at 02:34, David Wilson wrote: > Hi there, > > Python has no built-in way of doing this. You may consider writing > your own class if you like this pattern (I personally do): > > class Event(object): > def __init__(self): > self.subscribers = set()
... > def __isub__(self, subscriber): > self.subscribers.pop(subscriber) > return self A slight typo there. For sets s.pop() returns an arbitrary element and s.remove(x) or s.discard(x) removes the element x from the set s. For the OP: remove raises an exception if x is not in the set, discard does not. -- [ [EMAIL PROTECTED] <*> Antti Rasinen ] "The music of rebellion makes you wanna rage But it's made by millionaires who are nearly twice your age" -- http://mail.python.org/mailman/listinfo/python-list