Ad
  • Default User Avatar

    It might be faster--especially for larger numbers of handlers--since removing items from lists is O(n) on average vs. O(1) for sets, according to https://wiki.python.org/moin/TimeComplexity

    Using sets appears to be a viable option since "you should not worry about the order of handlers' execution" and "each handler will be subscribed at most once at any given moment of time" as per description.